VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: restodo on April 12, 2014, 22:03:14 PM

Title: Standard Payment Method Percentage problem
Post by: restodo on April 12, 2014, 22:03:14 PM
Hi,

I'm using VM 2.6.0 and I'm trying to configure a Standard Payment Method for Cash On Delivery with 5% of discount.

I can configure right but when I try to buy a product, the discount is incorrect.


For example if I buy a product that cost $ 1000 and I choose Cash On Delivery, total amount should be $ 950 ($ 1000 - $ 50).
But the real thing is that I have a total amount of $ 952,38 (the discount is $ 47,62).


##################

I've solved this problem.

This is the solution I've founded. Please developers look because I think it's a bug in VM 2.6.0 code.

I've modified /administrator/components/com_virtuemart/plugins/vmpsplugin.php

At line 997 you have:
         $cartTotalAmount=($cartTotalAmountOrig + $method->cost_per_transaction) / (1 -($method->cost_percent_total * 0.01));

And I've modified with:
         $cartTotalAmount=($cartTotalAmountOrig + $method->cost_per_transaction) * (1 +($method->cost_percent_total * 0.01));

The aritmethical operation of percentage is wrong in the original file.


Greetings from Argentina.
Title: Re: Standard Payment Method Percentage problem
Post by: Milbo on April 14, 2014, 12:27:32 PM
You use a fee as discount. Therefore you misuse it. This is not a useable fix, cause it would destroy it for all people using it correctly.

http://forum.virtuemart.net/index.php?topic=123359.msg421046#msg421046
Title: Re: Standard Payment Method Percentage problem
Post by: restodo on April 15, 2014, 00:13:25 AM
Quote from: Milbo on April 14, 2014, 12:27:32 PM
You use a fee as discount. Therefore you misuse it. This is not a useable fix, cause it would destroy it for all people using it correctly.

http://forum.virtuemart.net/index.php?topic=123359.msg421046#msg421046

Thanks for your answer but I haven't use fee as discount. I've used Percent of the total amount that's why I think there is a bug in VM 2.6.0.

I'm attaching a screenshot.




[attachment cleanup by admin]