Author Topic: Remove 'Add to Cart Button' for specific items  (Read 5517 times)

chicago

  • Beginner
  • *
  • Posts: 7
Remove 'Add to Cart Button' for specific items
« 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???

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28024
  • Always on vacation
    • Jenkin Hill Internet
Re: Remove 'Add to Cart Button' for specific items
« Reply #1 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.....
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 3.8.7 10374 on Joomla 3.9.24 PHP 7.4.12

chicago

  • Beginner
  • *
  • Posts: 7
Re: Remove 'Add to Cart Button' for specific items - SOLVED
« Reply #2 on: March 04, 2013, 10:27:24 am »
 :)
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28024
  • Always on vacation
    • Jenkin Hill Internet
Re: Remove 'Add to Cart Button' for specific items
« Reply #3 on: March 04, 2013, 10:30:50 am »
Neat solution!
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 3.8.7 10374 on Joomla 3.9.24 PHP 7.4.12

richdean77

  • Beginner
  • *
  • Posts: 18
Re: Remove 'Add to Cart Button' for specific items
« Reply #4 on: September 17, 2013, 15:19:52 pm »
Quote
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

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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2660
Re: Remove 'Add to Cart Button' for specific items
« Reply #5 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)?

bullertech

  • Beginner
  • *
  • Posts: 4
Re: Remove 'Add to Cart Button' for specific items
« Reply #6 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,