Reputation: 3189
I use smarty on a prestashop template.
this is the code I use
{Product::getProductCategoriesFull($product.id_product)}
It give me an array... with array inside. this is an exemple :
Array
(
[2] => Array
(
[id_category] => 2
[name] => Accueil
[link_rewrite] => home
)
[7] => Array
(
[id_category] => 7
[name] => Dancefloor
[link_rewrite] => dancefloor
)
[12] => Array
(
[id_category] => 12
[name] => other
[link_rewrite] => other
)
)
I would like to find a way to get all the "link_rewrite" element : home,dancefloor,other.
It's possible with php, but the script is on a .tpl file. So How can I do this with smarty ?
Upvotes: 1
Views: 664
Reputation: 111829
You should try:
{assign var=items value=Product::getProductCategoriesFull($product.id_product)}
{foreach $items as $v}
{$v["link_rewrite"]}
{/foreach}
Upvotes: 2
Reputation: 264
If i am not wrong. I understand that you want to show Category link , this is the best solution. I have tested my self the code in my local prestashop site
{assign var=items value=Product::getProductCategoriesFull($product.id_product)}
{foreach $items as $v}
<a href="{$link->getCategoryLink($v['id_category'], $v['link_rewrite'])|escape:'html':'UTF-8'}"> {$v['name']}</a>
{/foreach}
Upvotes: 0