VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: andorfy on May 14, 2020, 23:20:42 PM

Title: How to change the payment fee calculation method?
Post by: andorfy on May 14, 2020, 23:20:42 PM
I already read the FAQ about the calculation method of payment fees, here https://forum.virtuemart.net/index.php?topic=123359.0 (https://forum.virtuemart.net/index.php?topic=123359.0), and I understand why is it good usually, but I would like to change it to the "simple way".
So if I give a 5% discount to a $100 cart total amount, I would like to see a $95 sum.

Where should I change the code?

VirtueMart 3.6.10 10211
Joomla 3.9.18
PHP 7.3.17
Title: Re: How to change the payment fee calculation method?
Post by: pinochico on May 15, 2020, 05:31:58 AM
Find calculation for: $cartTotalAmount
Title: Re: How to change the payment fee calculation method?
Post by: andorfy on May 17, 2020, 00:24:36 AM
Thank you pinochico!

I found the file (/administrator/components/com_virtuemart/plugins/vmpsplugin.php), and changed, now it works as I would like.

I have only one last question. Is there any way to move this file somwhere else, to make it an override, so if I update the VM, it won't be overwritten with the new version?
I try to put it to the /templates/my_template_name/html/com_virtuemart/plugins/ folder, as the other overrides, but it didn't works.
Title: Re: How to change the payment fee calculation method?
Post by: GJC Web Design on May 17, 2020, 11:31:10 AM
move it into your payment plugins

have a look at most of the bundled payment methods .. they all over ride the function

function setCartPrices (VirtueMartCart $cart, &$cart_prices, $method, $progressive = true) {
    // your code
}