colorlife Posted October 20, 2016 Share Posted October 20, 2016 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 More sharing options...
rocky Posted October 22, 2016 Share Posted October 22, 2016 Have you considered using the "Online Only" option on products and then using translations to change it to "Digital"? Link to comment Share on other sites More sharing options...
colorlife Posted October 25, 2016 Author Share Posted October 25, 2016 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 More sharing options...
rocky Posted October 25, 2016 Share Posted October 25, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now