Works for me !!! Big thanks.
In effect the rounding is applied to all number calculations. I just needed to final VAT field to behave. I wonder if there is a more elegant way of resolving rounding.
Works for me !!! Big thanks.
In effect the rounding is applied to all number calculations. I just needed to final VAT field to behave. I wonder if there is a more elegant way of resolving rounding.
// Wrapper function for round()
function zen_round($number, $precision) {
/// fix rounding error on GVs etc.
$number = round($number / 5, $precision) * 5;
return $number;
}
I have done the above to /includes/functions/functions_general.php
and it shows correctly in my website.
However, the invoice at admin>order is showing without rounding off.
I then add the above to the file myadmin/includes/functions/functions_general.php, the Price (inc) is showing with round off but Price (ex) is not.
FYI I don't set tax for my products.
Please advise.
another problem i found is, after rounding off to nearest 5 cents, the total value might be incorrect.
eg.
subtotal 23.40 (actual 23.39)
shipping 8.65 (actual 8.63)
total 32.00 (actual 32.02)
any solution?
Just did this change in 155d and it seems to work fine.
In this 155 version the code to change is on lines 214 - 220!
I am curious that the change has the variable $number whereas the code to be replaced has $value; could this change cause unexpected consequences?
Thanks for any advice!
I just noticed when a customer pays with PayPal then they pay the correct "unrounded" amount. So if, for example, the unrounded amount is 50.03 and the invoice shows 50.05 then they pay 50.03.
It would be nice for the customer to pay the invoice amount especially as in Switzerland prices in cents have to be multiples of 5; so 5, 10, 15 etc.
I just have to find the correct file to insert
Having said that PayPal works OK with these "illegal" amounts.Code:$number = round($number / 5, $precision) * 5; return $number;
Bookmarks