News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Remove 'Add to Cart Button' for specific items

Started by chicago, March 01, 2013, 15:45:07 PM

Previous topic - Next topic

chicago

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

jenkinhill

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.....
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

chicago

 :)
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  :)

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

richdean77

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?

Maxim Pishnyak

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)?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

bullertech

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,