Jump to content

Associated categories in a product tab


Anissneo

Recommended Posts

Hi,

I followed this solution here (thank you vekia) and it works fine.

But in this code (used in product.tpl)

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

I want to exclude many category.

So i tried

{if $cat.id_category!=2 || $cat.id_category!=3 || $cat.id_category!=4}

But it doesn't work.

 

 

 

And i want to customize name of category and subcategory with css.

 

 

Please help

Link to comment
Share on other sites

it doesn't work with "AND".

{if !in_array($category.id_category, array(4,25,36,55))} 

array crashes my site.

 

it seems like he don't accept php functions.

I used 

{if $cat.id_category => 80 AND $cat.id_category < 85}

and it works fine (categories i want to be excluded are between 80 and 85)

 

thanks for your responses  :)

Link to comment
Share on other sites

it doesn't work with "AND".

{if !in_array($category.id_category, array(4,25,36,55))} 

array crashes my site.

 

it seems like he don't accept php functions.

I used 

{if $cat.id_category => 80 AND $cat.id_category < 85}

and it works fine (categories i want to be excluded are between 80 and 85)

 

thanks for your responses  :)

It was just an example. In this case 

{if !in_array($cat.id_category, array(4,25,36,55))}
  • Like 1
Link to comment
Share on other sites

  • 3 years later...

Hi,
Please for this code :

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

In my case i want to display only "Level depth 3"
Thank you.

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