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

Standard Payment Method Percentage problem

Started by restodo, April 12, 2014, 22:03:14 PM

Previous topic - Next topic

restodo

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.

Milbo

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

restodo

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]