MAGENTO How to Check if the current page is Category or Not
After a great deal of frustration and numerous tantrums I discovered the solution is to wrap the code in a loop that checks if it’s a category page.
//LOOP TO CHECK IF ITS A CATEGORY PAGE
<?php if (Mage::registry('current_category')) { ?>
//INNER LOOP
<?php if(Mage::registry('current_category')->getId() == 5):?>
<p>Shows this paragraph is the category id="5"</p>
<?php else: ?>
<p>Else show this for different category pages</p>>
<?php endif; ?>
//SHOW THIS CONTENT IF ITS A CMS PAGE
<?php } else { ?>
<p>Else show this paragraph for all other pages</p>>
<?php } ?>
0 comments:
Post a Comment