4

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'

6
  • My man, I am afraid that VM has no popularity whatsoever here on JSE (and among 'serious joomlers'), at least that is my experience. Just click on that tag 'virtuemart' and see for yourself how many questions are left unanswered. Though I might be proven wrong, who knows...
    – Mikan
    Commented Nov 18, 2016 at 16:28
  • Without going into possibility of template overrides (you also haven't mentioned which template are you using), this can be achieved by 'simple and dirty' CSS tricks. Post a link to your site for more precise answer.
    – Mikan
    Commented Nov 21, 2016 at 13:57
  • @Mikan There could be any template, right now it is basic 'protostar'. Though, I don't want to achieve it by template overriding. I am looking for some function call, as I have built a custom field, so I am already using VM functions.
    – Anant
    Commented Nov 21, 2016 at 15:18
  • ok, someone ansered that on VM forum, and it is to $product->orderable to false, though when it is set to false then a new button takes its position for that product, and that is 'choose a variant'. Any solution to remove this button too?
    – Anant
    Commented Nov 21, 2016 at 16:32
  • 1
    yes, css trick would never follow a generic rule for all templates. Though I finally able to achieve it. Check my answer
    – Anant
    Commented Nov 22, 2016 at 10:24

1 Answer 1

5

I am able to replace virtuemart 'add to cart' button. I am able to achieve it by help from Studio42 on virtuemart forum, discussion on this url.

The following set of code, with php only will work:

//this will remove 'addtocart' button, but show 'choose a variant', 
// and also show quantity selector
$product->orderable = false;

//this along with above line of code will totally replace it 
//with your own button
$product->addToCartButton = '<div>my own button</div>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.