I'm trying to display a message just on a certain category page in magento?

I know how to do this on a product page so like:

if (in_array(415, $_product->getCategoryIds())) {?>
    <span style="font-weight:bold;color:#69a740;padding:0 5px;font-size:14px;">Text</span>
<?php } ?>

But not sure how to do this on a category page?


You can try this:

$category = Mage::registry('current_category');
if ($category && $category->getId() == 415) { ?>
    <span style="font-weight: bold; color: #69a740; padding: 0 5px; font-size: 14px;">Text</span>
<?php }?>

Try this.

<?php if (Mage::registry('current_category')->getId() == 415) {?> <span style="font-weight:bold;color:#69a740;padding:0 5px;font-size:14px;">Text</span> <?php } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.