Jump to content

How to remove add to cart button for specific category?


jamshidpour

Recommended Posts

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 by jamshidpour (see edit history)
Link to comment
Share on other sites

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

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