Strange calculations with product price in order
-
16-10-2019 - |
Question
We've come across a strange calculation error in our Magento setup.
Magento 1.7.0.2 with PHP 5.4
In the above picture you see two products essentially the same. However the top product has a row total of 24.99 and the second product comes with 25.00
I know Magento 1.8 solves a lot of rounding errors but does it solve this one? We can't really install Magento 1.8, this is a highly customized shop and 1.8 is still in alpha.
We have the feeling it has something to do with PHP 5.4, we are currently investigating this with a VM, I was hoping someone here has a better insight on why this happens or how can we possibly approach this problem.
If you need more information I'd be happy to tell you more. Thank you in advance.
Solution 2
I temporarily put in a workaround for this. I believe this issue is fixed in 1.8 but upgrading is not an option and I can't easily locate the exact code I need that would fix it.
So instead I simply forced it to ommit the _deltaRound
function.
I am aware that this might cause other issues, so use at your own risk.
app/code/core/Mage/Tax/Model/Sales/Total/Quote/Subtotal.php:596
protected function _deltaRound($price, $rate, $direction, $type='regular')
{
return $price; // Workaround for 9.99 bug
if ($price) {
$rate = (string) $rate;
$type = $type . $direction;
app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php:724
protected function _deltaRound($price, $rate, $direction, $type='regular')
{
return $price; // 99 cents workaround
if ($price) {
$rate = (string) $rate;
$type = $type . $direction;
OTHER TIPS
Do you use System > Configuration > Tax > Calculation Settings > Tax Calculation Method Based On > Total
? If yes this could explain the different amounts on identical products since Magento distributes the rounding across items. Using Row Total should not produce different amounts.