Complementary attributes: Difference between revisions

m
Tag: 2017 source edit
Line 105: Line 105:


==Visibility==
==Visibility==
<code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array('mycategory',$cats ))) ? 1 : 0</code>
To display one attribute only if the object belongs to a certain category, you can use the following code  :
<code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array('mycategory_id',$cats ))) ? 1 : 0</code>
676

edits