Jump to content

[SOLVED] disable add to cart button for specific catefory or specific products


Recommended Posts

I have searched the forum and found out how to completely remove add to cart button (if i want to just show the products without the ability to sell them for example).

But what if i want for some products or whole category to have the ability to be sold through the add to cart button and for some products or better for a whole category not to be sold;

Link to comment
Share on other sites

You could hide all the "Add to cart" buttons in a certain category by changing the "Add to cart" code in product-list.tpl from:

{if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
{l s='Add to cart'}
{else}
{l s='Add to cart'}
{/if}



to:

{if $id_category != 1}
{if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
{l s='Add to cart'}
{else}
{l s='Add to cart'}
{/if}
{/if}


where 1 is the id of the category you don't want the "Add to cart" button to appear on.

Link to comment
Share on other sites

rocky, thank you VERY MUCH for your reply.

the truth is that i had in my mind something like this which is describred in this topic
http://todoprestashop.com/foro/viewtopic.php?f=17&t=434&start=10

i tried it with the latest prestashop version but it did not work.

my whole right sidebar keeps on dissapearing...

i tried it many times following the instructions but no luck.

but it is exactly what i want.

to define through admin panel witch products will not be able to buy through add to cart
followed by a customized message.

Link to comment
Share on other sites

I see, so someone modified Prestashop v1.0.0.8 to add a checkbox on each product you can tick when you don't want the "Add to cart" button to appear, but you can't get it to work in v1.2.4. You'll need to compare the original files with the modified ones on that site and find what they changed. If you can make the same changes in your Prestashop v1.2.4 files instead of just overwriting the files, hopefully it will work. Unfortunately, I don't have time to do it myself at the moment.

Link to comment
Share on other sites

rocky i did what you told and indeed...

the add to cart button has vanished from the category i wanted.

But...

When i click on the view button of a product of ths category,
the add to cart button is still there on the details page...

What file do i have to modify in oder to vanish the add to
cart button from the details page for the products of the
specified category;

Thanks for hearing me.

Link to comment
Share on other sites

You would need to modify product.tpl in your theme's directory and do a similar thing as before, assuming that the you've set the default category of the product to the category it is hidden from:

{if $product->id_category_default != 1}

Link to comment
Share on other sites

rocky thanks for replying,

but,

i opened product.tpl file and i dont know what exactly to change...

please if you have some spare time would it be possible to be more specific.

in what part of the code should i insert {if $product->id_category_default != 1};

thank you very much.

Link to comment
Share on other sites

You should put the code above line 283 and {/if} after the line:

quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>

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