php - Magento: hide attributes from certain categories -



php - Magento: hide attributes from certain categories -

i want hide attributes in category page categories, instance 21 , 24. tried or statement guess it's not in right position ignores both:

<?php $category = mage::getmodel('catalog/layer')->getcurrentcategory(); if(($category->getid()!=21) || ($category->getid()!=24)) { ?> <strong>capacity:</strong> <?php echo $_product->getcapacity(); ?> <br> <strong>graduations:</strong> <?php echo $_product->getgraduations(); }?>

can point me in right direction

if(($category->getid()!=21) || ($category->getid()!=24)) {

let's see happens here:

if id 21 "if-clause" not pass first look (false) - id != 24 passes sec 1 (true). since "||" in php not "exclusive or" passes whole if (false or true = true) , attributes printed.

if id 24 first of clause passes (true) sec 1 ignored totally. (true or true) - attributes printed.

it's "logic" issue - 1 of "expressions" true since number cannot 21 , 24 same time cause if-clause skip ;)

hint solution: want display attributes when id not 21 , not 24

php magento

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -