News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

BUG: payment min/max amount doesn't account for coupons

Started by thebeuving, September 21, 2012, 02:05:16 AM

Previous topic - Next topic

thebeuving

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
Founded in 2005, Khoza Technology, Inc. formerly SRI Hosting, Inc. is an IT services company with proven success building hosted services, applications, and websites.

https://khoza.com

Jumbo!

Which version of VirtueMart are you using? Please upgrade to VM 2.0.11 which should fix this.

thebeuving

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
Founded in 2005, Khoza Technology, Inc. formerly SRI Hosting, Inc. is an IT services company with proven success building hosted services, applications, and websites.

https://khoza.com

thebeuving

Founded in 2005, Khoza Technology, Inc. formerly SRI Hosting, Inc. is an IT services company with proven success building hosted services, applications, and websites.

https://khoza.com

JUser2297

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.

thebeuving

It would sure be great if we could get this fixed!
Founded in 2005, Khoza Technology, Inc. formerly SRI Hosting, Inc. is an IT services company with proven success building hosted services, applications, and websites.

https://khoza.com

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

thebeuving

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
Founded in 2005, Khoza Technology, Inc. formerly SRI Hosting, Inc. is an IT services company with proven success building hosted services, applications, and websites.

https://khoza.com