VirtueMart Forum

VirtueMart 2 + 3 + 4 => 3rd party extension => Topic started by: seyi on June 25, 2012, 18:31:23 PM

Title: Trigger Coupon Automatically (Plugin)
Post by: seyi on June 25, 2012, 18:31:23 PM
This is a Virtuemart 2 Plugin.

Automatically trigger a coupon code when a product is added to the shopping cart.

Its very simple, install the plugin, enable it, and enter the coupon code you want to be automatically triggered. If a coupon code already exists in the cart, the auto coupon code is not run.

http://awodev.com/products#plg_awocoupontrigger
Title: Re: Trigger Coupon Automatically (Plugin)
Post by: alin09ro on November 20, 2012, 23:05:26 PM
it's a great plugin but it needs some options:

- when you update the quantity the plugin doesn't load/unload the coupon
- should have the option to select multiple coupons and apply them based on cart total value
Title: Re: Trigger Coupon Automatically (Plugin)
Post by: seyi on November 26, 2012, 19:09:24 PM
Thanks for the feedback.  I fixed the update/delete problem.  It would be best to uninstall the previous version before installing this one as it is no longer a vmpayment plugin, it is now a system plugin.  To your other points:
1) cart total value - this can already be set up within the coupon you are creating, it would be redundant to add this feature
2) multiple coupons - this is not something supported by Virtuemart, it will only allow one coupon at a time so not sure it is very useful
Title: Re: Trigger Coupon Automatically (Plugin)
Post by: wtkagb on January 29, 2013, 14:58:48 PM
Can you apply this to more than 1 coupon?

I have several coupons that I would like to auto trigger
Title: Re: Trigger Coupon Automatically (Plugin)
Post by: seyi on January 29, 2013, 19:29:41 PM
Hi,

Virtuemart coupon system is built to accept just 1 coupon code, so even if there was a box for 2, it will only accept the first one.

If you need that functionality, then AwoCoupon pro will allow this through parent coupons.
Title: Re: Trigger Coupon Automatically (Plugin)
Post by: baggiesmad on November 28, 2014, 13:33:53 PM
Quote from: seyi on June 25, 2012, 18:31:23 PM
This is a Virtuemart 2 Plugin.

Automatically trigger a coupon code when a product is added to the shopping cart.

Its very simple, install the plugin, enable it, and enter the coupon code you want to be automatically triggered. If a coupon code already exists in the cart, the auto coupon code is not run.

http://awodev.com/products#plg_awocoupontrigger

Installed this, works fine apart from the discount being applied to the final price, it doesnt actually display a notification that the customer is saving or that there has been a discount applied?
Title: Re: Trigger Coupon Automatically (Plugin)
Post by: seyi on December 01, 2014, 17:57:31 PM
Hello,

No, it does not display a message when a coupon is added to the cart.  But I think its easy enough

in www/plugins/system/awocoupontrigger/awocoupontrigger.php, around line 34 is this

<?php
$cart->setCouponCode($coupon_code);
$cart->getCartPrices(); // needed it to fix the cart prices

?>



Change it to this

<?php
$orig_code $cart->couponCode;
$msg $cart->setCouponCode($coupon_code);
$cart->getCartPrices(); // needed it to fix the cart prices
if(empty($orig_code) && !empty($msg)) {
JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'FALSE),$msg);
}
?>