0

I'd like to show an icon only in my 'shoes' category listing page (ID: 3).

I've put in place the PHTML which will create the icon in the list.phtml file. But currently it appears in all categories, I want it to appear in just the category 'shoes' which has the ID: 3.

Here's my current code in catalog/product/list.phtml

<div style="position:absolute;top:-10px;right:-15px;">
<img src="mysite.com/myshoesimage.png" width="100" alt="My Shoes Cat Specific Icon" />
</div>

Can anyone please suggest an edit to make this show only in the specific category?

1

2 Answers 2

1

Use this code:

<?php if(Mage::registry('current_category')->getId()==3){ ?>
<div style="position:absolute;top:-10px;right:-15px;">
<img src="mysite.com/myshoesimage.png" width="100" alt="My Shoes Cat Specific Icon" />
</div>

<?php } ?>
1

You can try:

$catId = Mage::registry('current_category')->getId();

if($catId==3):?>
    <div style="position:absolute;top:-10px;right:-15px;">
        <img src="mysite.com/myshoesimage.png" width="100" alt="My Shoes Cat Specific Icon" />
    </div>
<?php endif;?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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