Jump to content

[SOLVED] Need help with small custom coding 'display content if category_id = 3'


charlie123

Recommended Posts

Hello,

I have edited one of the free modules to display additional tab on product page, but I want this tab to be displayed only if product is placed in specific category (eg cat id 3)

 

All I need is "IF" code formula. Im not a coder and I don't know what formula need to be used. Basically I need something like this:

 

 

{if $product is placed in category id 3 ->display content from below} <--- what is the correct code for this?

 

<li><a href="#msTabHolder" class="idTabHrefShort">{l s='Extra tab' mod='productcomments'}</a></li>

 

{/if}

 

Thank you

Link to comment
Share on other sites

you could try

 

{if $product->id_category_default==3}
<li><a href="#msTabHolder" class="idTabHrefShort">{l s='Extra tab' mod='productcomments'}</a></li>
{/if}

 

Also let me know what template file you are trying to edit.

 

Thank you, your solution seems to works perfect. Can I also ask how I can add multiple categories ID's please? For example if I want to display content under category 3 and 5 and 6 instead of only 3? Thank you for your help! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...