I want to hide the payment logos for 1 product category. I've taken a look and they're in a block in the
local.xml, but as far as I know XML doesn't like if statements.
Is there any way of doing it on PHP?
You can use the
Custom Layout Update field in the
Custom Design tab when editing a category if you want to add custom XML.
If you want to keep this in your
local.xml, the category controller loads a handle called
CATEGORY_ followed by the category ID. So you could basically do the following:
<CATEGORY_IDHERE> <reference name="left"> ...remove my icon... </reference> </CATEGORY_IDHERE>
The quickest and easiet way in PHP is to check the product category, Say that the category name is 'cat1' so, your block will look like this:
$product = Mage::getModel('catalog/product')->load($productId); $cats = $product->getCategoryIds(); foreach ($cats as $category_id) : $_cat = Mage::getModel('catalog/category')->load($category_id) ; if ($cat->getName()==="cat1"): // Set div style=display:none to hide it div class="payment-logos" style="display:none !important;" endif; // End if endforeach; // End foreach
Have fun !!