VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: thebeuving on September 21, 2012, 02:05:16 AM

Title: BUG: payment min/max amount doesn't account for coupons
Post by: thebeuving on September 21, 2012, 02:05:16 AM
We have a client that has a coupon code that gives a user 100% off of their order. In order to allow a user to checkout I want to create a payment option using the standard payment plugin that is only available when the maximum price is 0.01.

While virtuemart allows you to configure that in the backend, the Minimum and Maximum amounts are not compared against a variable that takes into account coupon discounts.

My suggested fix is that we change line this in all the payment plugins, inside of function checkConditions change


$amount = $cart_prices['salesPrice'];


To


$amount      = $cart->pricesUnformatted['billTotal'];


This is on line 234 in the authorize.net plugin and 213 in the standard payment plugin in SVN r6474.

Thanks,
David
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: Jumbo! on September 23, 2012, 09:31:10 AM
Which version of VirtueMart are you using? Please upgrade to VM 2.0.11 which should fix this.
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: thebeuving on April 09, 2013, 00:13:14 AM
I am on virtuemart 2.0.20 now and this is still an issue. Both the standard payment option and the authroize.net payment options do not take the coupon discounts in to account when comparing to min/max amount.

Thanks,
David
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: thebeuving on June 19, 2013, 23:48:39 PM
Bump, this is still an issue.
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: JUser2297 on June 20, 2013, 23:45:30 PM
This seems to be an issue with VM still.
However, by editing /plugins/vmpayment/standard/standard.php as the original post suggest, it does fix the problem. Still, this should be fixed in the next Virtuemart update.
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: thebeuving on June 26, 2013, 23:17:43 PM
It would sure be great if we could get this fixed!
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: Milbo on June 27, 2013, 11:37:32 AM
TheBeuving, we invested 2 hours to fix this problem. There is no easy fix possible, because what you want todo is absolutly uncommon. You fix works only correct in your conditions and you have a lot of 0.0 in your calculation. So your fix works only when the payment costs are 0. Because the value $cart->pricesUnformatted['billTotal']; contains already the costs for shipment and payment. For this special case it is easier just to copy the standard plugin. Change the name in the xml, pack it as zip and install the modified standard as your own plugin.
Title: Re: BUG: payment min/max amount doesn't account for coupons
Post by: thebeuving on June 27, 2013, 18:33:43 PM
Hey Milbo,

Sorry to hear that my simple solution won't work, I am not that surprised as I haven't had much of a chance to fix this.

Maybe what you are saying is that nobody cares enough to fix it, or to pay to have it fixed?  If this is the case, could you contact me offline with an estimate to add this functionality? Alternatively, could you give our team any suggestions so that if we code a fix it will be accepted?  We really like VirtueMart and our client may be able to help support the project and/or contribute code.

I do know there are a few other people having similar issues:
https://forum.virtuemart.net/index.php?topic=110348.0
http://forum.virtuemart.net/index.php?topic=99602.5

Thanks,
David