News:

Support the VirtueMart project and become a member

Main Menu

Remove 'add to cart button' on all view except productdetails

Started by anant_maks, November 18, 2016, 16:05:47 PM

Previous topic - Next topic

anant_maks

I have created a custom plugin. I want a buyer should only be able to 'add to cart' using these created fields, only on productdetails view. Until then, no add to cart button should be displayed. I also achieved this using javascript via a system plugin, though I am looking for a more better solution, as removing it via some function like - plgVmOnDisplayProductFEVM3 or something else. As a different templace could have different class for 'addtocart-bar'

I would also like to know is there anyhow we can remove 'quantity-box' and 'quantity-control' only, from 'addtocart-bar'
Anant Garg

GJC Web Design

just clone the sublayout and do the change

then call this in the category views
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

Check the jinput  "view" value and set $product->orderable to false when this is not "productdetails"

anant_maks

Thanks @studio42, that is what I was looking for. I didn't though it would be that simple. Though there is one more thing, I hope you can suggest something better for it. Whenever $product->orderable is set to false then a new button takes its position for that product, and that is 'choose a variant'. I even didn't need that, on debugging more into $product, I didn't found any parameter that can remove this button too.
Anant Garg

Studio 42

You can overide addtocart button if you prefere using in the same loop
$product->addToCartButton = 'my new button';
if you use $product->addToCartButton = '';
it not work, for empty button use $product->addToCartButton = '<span></span>';
Another solution is to modify the sublayouts/addtocartbtn.php but this is then for all the shop including non orderable in productdetails view..

anant_maks

@Studio42 ok, this worked well. Thanks for all your responses. I wanted to create my own button and I am able to do it now.
Thanks again!
Anant Garg

driver_wedge

Quote from: Studio 42 on November 21, 2016, 18:33:40 PM
Another solution is to modify the sublayouts/addtocartbtn.php but this is then for all the shop including non orderable in productdetails view..

Hi guys... if I wanted to achieve the above (have a new button for each product on category page that simply links to product page), which specific strings should I be looking at changing? I could probably work it out after a bit of messing about, but any advice that will save me on added stress would be much appreciated.

Many thanks!!!

Studio 42

@driver_wedge : if you need ofr the whole shop, then remove addtocart render in the sublayout products.

driver_wedge

Thanks S42. Basically, I want to get rid of 'choose a variant' from the products that have variants, and therefore not orderable....therefore, I think the simplest option is to remove the add to cart button althogher across the site and replace it with a new button which displays 'view product', or something similar. I would prefer customers to visit the product page anyway, rather than add to cart from the category page.

I realise that I can probably get this done by someone more knowledgeable than me for a small fee, but I'd like to have a look and understand how the relevant php code renders in the front end.

Does that make sense?

Thanks again...