Jump to content

Show product Tags in product page


joanlafulla2

Recommended Posts

Hi. I'm trying to show the product tags in product.tpl.

<ul class="my_tags">
	{foreach from=Tag::getProductTags(Tools::getValue('id_product')) key=k item=v}
  		{foreach from=$v key=lang_id item=value}
			<li><a href="{$link->getPageLink('search', true, NULL, "tag={$value|urlencode}")}">{$value|escape:html:'UTF-8'}</a></li>
		{/foreach}
	{/foreach}
</ul>

The problem is that every tag is showed two times in the different two languages.
I would like to filter the tags by language, but the code doesn't work.

Link to comment
Share on other sites

{assign var=tags value=Tag::getProductTags($product->id)}
{assign var=id_lang value=Context::getContext()->language->id}
{assign var=product_tags value=$tags[$id_lang] }

<ul>
{foreach from=$product_tags key=k item=v}
{foreach from=$v item=value}
<li><a href=”{$link->getPageLink(‘search’, true, NULL, “tag={$value|urlencode}”)}”>{$value|escape:html:’UTF-8′}</a></li>
{/foreach}
{/foreach}
</ul>

 

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...