jamshidpour Posted May 30, 2022 Share Posted May 30, 2022 (edited) Hi mates I am using prestashop 1.6.1.24 and trying to remove add to cart button for specific category (category ID 3) from both "Category page" and "Product page". In other word i wand to disable purchasing products of category ID 3. I used the code below in product-list.tpl and it worked fine and add to cart buttons removed in category page of ID 3 {if $smarty.get.id_category != 3} ... {/if} Now i want to remove add to cart button in product pages of category ID 3. I have edited product.tpl and inserted the below code just before <div class="box-cart-bottom"> but it doesn't work: {if $product->id_category != 3} ... {/if} What is the problem? Am i doing something wrong? Your help is highly appreciated. Edited May 30, 2022 by jamshidpour (see edit history) Link to comment Share on other sites More sharing options...
Prestachamps Posted May 30, 2022 Share Posted May 30, 2022 Hi @jamshidpour, for the product page, the default category of product is in the variable $product->id_category_default , so the correct condition should be: {if $product->id_category_default != 3} ... {/if} I hope that I could help. Have a nice day, Leo. 2 Link to comment Share on other sites More sharing options...
jamshidpour Posted May 31, 2022 Author Share Posted May 31, 2022 Thanks Prestachamps, as i learned $product->id_category_default is the variable for default category of product, what if when we want to mention the parent category of a product? Imagine we have a category named A and it has 2 sub-categories named X and Y. The product is in category A and sub-category X and the default category for the product is sub-category X. Now we want to remove add to cart button for all products in parent category of A. How we should mention the parent category, not only the default category? 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