Jump to content

Add new badg for specific category


colorlife

Recommended Posts

Hello, 

 

i use prestashop 1.6.1 and Defoult theme. I need to add a badge on image and category and this appear only if category is "digital".

 

I have a lot of category and one of this (ID 89) name "digital" sell only digital produt and i like display a badge (similar as "new" badge) on image of product that it save in this specific category.

 

Is possibile?

Thanks

Link to comment
Share on other sites

Hello, no becouse i use this for other product that is only online. 

 

I think to create a functions with this, if product is on category with ID89 show badge on image. I try with put this code on category.tpl and product.tpl

{if $category->id_category == 89}
<div id="digital></div>
{/if}

But thi not work :(

Link to comment
Share on other sites

Try the following in product.tpl:

{if in_array(89, $product->getCategories())}
<div id="digital"></div>
{/if}

and the following in product-list.tpl:

{if in_array(89, Product::getProductCategories($product.id_product))}
<div id="digital"></div>
{/if}
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...