VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: gldproducts on November 20, 2012, 00:06:15 AM

Title: How can I turn off the cart for some products
Post by: gldproducts on November 20, 2012, 00:06:15 AM
Can somebody please tell me how I can turn off the "Add To Cart" button on certain products? I'm running VM 2.0.14 and Joomla 2.5.8. I would really appreciate it. I'm looking to only have PayPal as the option as ell right now.
Title: Re: How can I turn off the cart for some products
Post by: bytelord on November 20, 2012, 09:52:28 AM
Hello,

You could use the option  Displays 'Notify Me' instead of 'Add To Cart' button under Configuration-> Shopfront ->  Action when a Product is Out of Stock. So you could place those products under 0 stock and the add-to-cart button will not appeared.

An other way i am thinking is to create a custom field with the option Show Cart Button = TRUE (boolean) by default, if you select FALSE then you could override your productdetails/default_addtocart.php when this customfield is false do not show the add-to-cart button

Hope it helps

Regards
Title: Re: How can I turn off the cart for some products
Post by: WebStuff on November 20, 2012, 15:43:34 PM
Set the price to 0.00 and select Virtuemart->Configuration->Configuration->Pricing->"Show call for price, when the price is empty"
Title: Re: How can I turn off the cart for some products
Post by: bytelord on November 20, 2012, 15:46:29 PM
If i am not mistaken the product have a price ....

Regards
Title: Re: How can I turn off the cart for some products
Post by: WebStuff on November 20, 2012, 15:57:35 PM
You're right bytelord.
Sorry. :(
Title: Re: How can I turn off the cart for some products
Post by: WebStuff on November 20, 2012, 16:16:18 PM
Actually if you create a default.php override file and edit it to exclude the addtocart code then assign that to the products you want that should do it.
Title: Re: How can I turn off the cart for some products
Post by: bytelord on November 20, 2012, 16:31:11 PM
@mirrorsandglass

Yes that will work also ...

an override for the productdetails/default.php to not load the template default_addtocart.php

Regards
Title: Re: How can I turn off the cart for some products
Post by: WebStuff on November 20, 2012, 16:49:06 PM
Just done this as a test and it works.
Comment out:
// Add To Cart Button
// if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
//if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {
    //echo $this->loadTemplate('addtocart');
//}  // Add To Cart Button END
.
Make sure your new filename is not longer than 16 characters as it won't save it in the product override field due to the database field only being 16 chars long.
Title: Re: How can I turn off the cart for some products
Post by: gldproducts on November 26, 2012, 19:39:05 PM
Quote from: bytelord on November 20, 2012, 09:52:28 AM
Hello,

You could use the option  Displays 'Notify Me' instead of 'Add To Cart' button under Configuration-> Shopfront ->  Action when a Product is Out of Stock. So you could place those products under 0 stock and the add-to-cart button will not appeared.

An other way i am thinking is to create a custom field with the option Show Cart Button = TRUE (boolean) by default, if you select FALSE then you could override your productdetails/default_addtocart.php when this customfield is false do not show the add-to-cart button

Hope it helps

Regards

Thanks byLord. I set the stock to zero and now displaying 'Notify Me' instead of 'Add To Cart' button. that seems to work for now. I'll work to comment out the notify me.

http://www.gldgames.com

let me know what you think if you get a chance. ;D
Title: Re: How can I turn off the cart for some products
Post by: bytelord on November 27, 2012, 01:20:23 AM
Hello,

ok then, just create an override for default_addtocart.php as we said before and make your edits.

It's a nice site, need some work more and as it seems you are on the right track ;)

Regards