[-] Core: Fix rounding price computation with and without taxes #PSCFV-7796

This commit is contained in:
Rémi Gaillard
2013-02-13 17:48:40 +01:00
parent 2c2f4170bb
commit 7402d7b93d
+3 -5
View File
@@ -2668,7 +2668,6 @@ class ProductCore extends ObjectModel
// Add Tax // Add Tax
if ($use_tax) if ($use_tax)
$price = $product_tax_calculator->addTaxes($price); $price = $product_tax_calculator->addTaxes($price);
$price = Tools::ps_round($price, $decimals);
// Reduction // Reduction
$reduc = 0; $reduc = 0;
@@ -2680,14 +2679,14 @@ class ProductCore extends ObjectModel
if (!$specific_price['id_currency']) if (!$specific_price['id_currency'])
$reduction_amount = Tools::convertPrice($reduction_amount, $id_currency); $reduction_amount = Tools::convertPrice($reduction_amount, $id_currency);
$reduc = Tools::ps_round(!$use_tax ? $product_tax_calculator->removeTaxes($reduction_amount) : $reduction_amount, $decimals); $reduc = !$use_tax ? $product_tax_calculator->removeTaxes($reduction_amount) : $reduction_amount;
} }
else else
$reduc = Tools::ps_round($price * $specific_price['reduction'], $decimals); $reduc = $price * $specific_price['reduction'];
} }
if ($only_reduc) if ($only_reduc)
return $reduc; return Tools::ps_round($reduc, $decimals);
if ($use_reduc) if ($use_reduc)
$price -= $reduc; $price -= $reduc;
@@ -2700,7 +2699,6 @@ class ProductCore extends ObjectModel
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100); $price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
} }
$price = Tools::ps_round($price, $decimals);
// Eco Tax // Eco Tax
if (($result['ecotax'] || isset($result['attribute_ecotax'])) && $with_ecotax) if (($result['ecotax'] || isset($result['attribute_ecotax'])) && $with_ecotax)
{ {