Virtuemart 从查询字符串中申请优惠券

Virtuemart apply coupon from query string

我想在virtuemart申请优惠券。是否可以直接使用查询字符串?

我在 PHP 中使用以下语句成功添加了产品:

 header('Location: http://www.url.es/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=25&virtuemart_category_id[]=70&quantity[]=1');

你可以使用这个 url:

index.php?option=com_virtuemart&controller=cart&task=setcoupon&view=cart&coupon_code=COUPON_CODE

我已经用 virtuemart 3.0.18 测试过了,它工作得很好。

您可以通过检查表单在其中发布的输入字段来查看此 url 是如何创建的:

components/com_virtuemart/views/cart/tmpl/default_coupon.php

希望对您有所帮助