Jump to content

Show HTML block in .tpl file if a product has a specific tag


SkyHiRider
 Share

Recommended Posts

Which function do I need to call to check if a product has a specific tag?

I need to add a specific html code to a product ONLY if the product has one or more specific tags set in the backoffice.

 

I have found the .tpl file but I dont know for what variable I need to check so that my {if } {/if} statement is only active when a product is tagged as "stamp".

 

Can anyone give me any advice?

Share this post


Link to post
Share on other sites

use something like:

 {foreach from=Tag::getProductTags(Tools::getValue('id_product')) key=k item=v}
        {foreach from=$v item=value}
           {if $value=="MY TAG"}
               {l s='This produt has got MY TAG'}
           {/if}
        {/foreach}
    {/foreach}

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More