简体   繁体   English

除了productdetails之外,删除所有Virtuemart视图上的“添加到购物车”按钮

[英]Remove 'add to cart' button on all Virtuemart views except in productdetails

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. 我希望买家只能使用这些创建的字段“添加到购物车”,只能在productdetails视图中使用。 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. 我也通过系统插件使用javascript实现了这一点,虽然我正在寻找更好的解决方案,因为通过某些功能删除它 - 如plgVmOnDisplayProductFEVM3或其他东西。 As a different templace could have different class for 'addtocart-bar' 因为'addtocart-bar'可能会有不同的级别

I would also like to know is there anyhow we can remove 'quantity-box' and 'quantity-control' only, from 'addtocart-bar' 我还想知道,无论如何我们只能从'addtocart-bar'删除'quantity-box'和'quantity-control'

I am able to replace virtuemart 'add to cart' button. 我能够取代virtuemart'添加到购物车'按钮。 I am able to achieve it by help from Studio42 on virtuemart forum, discussion on this url . 我可以通过在美德智论坛上的Studio42帮助实现它,讨论这个网址

The following set of code, with php only will work: 以下一组代码,只有php才能工作:

//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>';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM