Skip to content
Permalink
Browse files

Rounding audit Product::getPriceStatic().

Audit is to find hardcoded rounding constants and to replace them
with _TB_PRICE_DATABASE_PRECISION_, or to remove them in case
parameters match the method's defaults.
  • Loading branch information...
Traumflug committed Feb 28, 2019
1 parent a23cdf8 commit 86cba0746d6ee2ea22aa3ba38e69e7b6e891821d
@@ -64,7 +64,7 @@ public function getProductPrice(
$idProduct,
$usetax = true,
$idProductAttribute = null,
$decimals = 6,
$decimals = _TB_PRICE_DATABASE_PRECISION_,
$divisor = null,
$onlyReduc = false,
$usereduc = true,
@@ -2600,7 +2600,13 @@ public static function ucwords($str)
public static function orderbyPrice(&$array, $order_way)
{
foreach ($array as &$row) {
$row['price_tmp'] = Product::getPriceStatic($row['id_product'], true, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : null), 2);
$row['price_tmp'] = Product::getPriceStatic(
$row['id_product'],
true,
(isset($row['id_product_attribute'])
&& ! empty($row['id_product_attribute'])) ?
(int) $row['id_product_attribute'] : null
);
}
unset($row);
@@ -2709,7 +2709,7 @@ public function ajaxProcessLoadProductInformation()
$decimals = 0;
if ($currency->decimals) {
$ecimals = Configuration::get('PS_PRICE_DISPLAY_PRECISION');
$decimals = Configuration::get('PS_PRICE_DISPLAY_PRECISION');
}
$this->ajaxDie(json_encode([
'result' => true,
@@ -364,7 +364,7 @@ protected function _assignSummaryInformations()
$product['id_product'],
!Product::getTaxCalculationMethod(),
$product['id_product_attribute'],
6,
_TB_PRICE_DATABASE_PRECISION_,
null,
false,
false,

0 comments on commit 86cba07

Please sign in to comment.
You can’t perform that action at this time.