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 09, 2014, 07:14:08 AM

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).

Could someone tell me how can I solve this problem?
It's a simple mathematical equation.


Thanks in advance!

restodo

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.