VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: chicago on March 01, 2013, 15:45:07 PM

Title: Remove 'Add to Cart Button' for specific items
Post by: chicago on March 01, 2013, 15:45:07 PM
Is there a simple way in which I can remove the 'Add to Cart' button for specific products? For example if a product was 'In store only'.

I've located the code which displays the button ..hot_furniturestore/html/com_virtuemart/productdetails/default.php

What next???
Title: Re: Remove 'Add to Cart Button' for specific items
Post by: jenkinhill on March 01, 2013, 16:01:11 PM
Use an override in joomla_root/templates/(your_template)/html/com_virtuemart/productdetails/
Set the override as Product Details Page for each required product or as Default Product Details Page if to be used for all products in a category.

References here:
http://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_template_system
http://www.ostraining.com/blog/joomla/overrides
http://forum.virtuemart.net/index.php?topic=90935.0
http://forum.virtuemart.net/index.php?topic=106459.0

And more.....
Title: Re: Remove 'Add to Cart Button' for specific items - SOLVED
Post by: chicago on March 04, 2013, 10:27:24 AM
 :)
Quote from: jenkinhill on March 01, 2013, 16:01:11 PM
Use an override in joomla_root/templates/(your_template)/html/com_virtuemart/productdetails/
Set the override as Product Details Page for each required product or as Default Product Details Page if to be used for all products in a category.

References here:
http://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_template_system
http://www.ostraining.com/blog/joomla/overrides
http://forum.virtuemart.net/index.php?topic=90935.0
http://forum.virtuemart.net/index.php?topic=106459.0

And more.....

Thanks for the pointers - I've solved the problem  :)

There is already an override Products Details Page in the location you suggested. I located this code :

if (!VmConfig::get('use_as_catalog',0)) { ?>

and changed to

if (!VmConfig::get('use_as_catalog',0) && $this->product->product_in_stock<>'2001' ) { ?>

Setting the 'In Stock' level for a product to 2001 hides the 'Add to Cart' button for that item  :)
Title: Re: Remove 'Add to Cart Button' for specific items
Post by: jenkinhill on March 04, 2013, 10:30:50 AM
Neat solution!
Title: Re: Remove 'Add to Cart Button' for specific items
Post by: richdean77 on September 17, 2013, 15:19:52 PM
QuoteThere is already an override Products Details Page in the location you suggested. I located this code :

if (!VmConfig::get('use_as_catalog',0)) { ?>

and changed to

if (!VmConfig::get('use_as_catalog',0) && $this->product->product_in_stock<>'2001' ) { ?>

Setting the 'In Stock' level for a product to 2001 hides the 'Add to Cart' button for that item

This works great on the products page to make the "Add To Cart" button disappear I have tried this on the category default.php file to make the "Add To Cart" button disappear, but it doesn't seem to work?


Any ideas?
Title: Re: Remove 'Add to Cart Button' for specific items
Post by: Maxim Pishnyak on September 17, 2013, 19:47:43 PM
if (!VmConfig::get('use_as_catalog',0) && $product->product_in_stock<>'2001' ) { ?>
Maybe it's time to check those sticked thread in this forum section (Template overrides and Co)?
Title: Re: Remove 'Add to Cart Button' for specific items
Post by: bullertech on November 14, 2013, 23:49:56 PM
Quote

Thanks for the pointers - I've solved the problem  :)

There is already an override Products Details Page in the location you suggested. I located this code :

if (!VmConfig::get('use_as_catalog',0)) { ?>

and changed to

if (!VmConfig::get('use_as_catalog',0) && $this->product->product_in_stock<>'2001' ) { ?>

Setting the 'In Stock' level for a product to 2001 hides the 'Add to Cart' button for that item  :)


I used the above code for the product details page. It worked. I am trying to accomplish the same thing for the category page.
I've got the add to card button on showing for each product on the category page but I want it to only show under the same circumstances as above.

I'm not a php developer and really have no idea what i'm doing. Can someone help me out please.

Thank You,