Jump to content

How To Check If The Product Is In A Subcategory Of A Given Category_Id


ToroLoco

Recommended Posts

Hello everybody,

 

I am new to the forum and just started to use prestashop, so I would like to apologize if this question is not asked on the proper subforum.

 

I am setting up a shop for a customer and using prestashop which I find fantastic and very customizable.

 

I would like to check if the product that the customer is viewing is also under a specific category_id and if it is to appear a link with the subcategory name that would guide them to the products of that subcategory.

 

I have put on the product.tpl below code, which works , but I need an END(&&) in that {if} to check if this item is also on a subcategory of 204.

Or could be a nested {if} under the first to check if the item is also on a subcategory of 204. 

{foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat}{if $cat.id_category == 204}
<span>{$cat.name|escape:'htmlall':'UTF-8'}</span>
{/if}
{/foreach}
 
Can I make something like this?
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...