676
edits
m (→Visibility) Tag: 2017 source edit |
m (→Visibility) Tag: 2017 source edit |
||
| Line 107: | Line 107: | ||
To display one attribute only if the object belongs to a certain category, you can use the following 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> | <code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array('mycategory_id',$cats ))) ? 1 : 0</code> | ||
To display one attribute only if the object is a product : | |||
<code>((preg_match('/type=product',$_SERVER['QUERY_STRING']) || preg_match('/type=0',$_SERVER['QUERY_STRING']))? 1 : 0</code> | |||
edits