Jump to content

Edit History

Verlonimo

Verlonimo

4 hours ago, Norben said:

Hi Tengler,
After doing this manipulation I have no access to my website, I restored my backup 😓
As I told you in my previous message, it's the only code that works (it's not yours) but it show all category path, I need to know if I can do some changes to display only the last level


<ul class="productcats">
 {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat}
{if $cat.id_category!=2}
    <li><a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a></li>
{/if}
{/foreach}
</ul>

Thank you.

Hi,

Not sure what exactly you want but You might want try to use smarty last iteration. So instead of

{if $cat.id_category!=2}

Try

{if $cat.last}

It should display only last item from foreach.

Thanks

Verlonimo

Verlonimo

4 hours ago, Norben said:

Hi Tengler,
After doing this manipulation I have no access to my website, I restored my backup 😓
As I told you in my previous message, it's the only code that works (it's not yours) but it show all category path, I need to know if I can do some changes to display only the last level


<ul class="productcats">
 {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat}
{if $cat.id_category!=2}
    <li><a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a></li>
{/if}
{/foreach}
</ul>

Thank you.

Hi,

Not sure what exqcly uou want but You might want try to use smarty last iteration. So instead of

{if $cat.id_category!=2}

Try

{if $cat.last}

It should display only last item from foreach.

Thanks

×
×
  • Create New...