Při zobrazení detailu produktu a použití skupinové slevy pro jiné měny, se ceny počítají chybně. Je to způsobeno tím, že se cena nepřepočítá dle aktuálního kurzu vybrané měny. Níže uvedenou úpravou docílíte korektního přepočtu.
Ukázka chybného zobrazení a po úpravě:
Soubor pro úpravu: controllers/ProductController.php
Původní kód:
public function formatQuantityDiscounts($specificPrices, $price, $taxRate) { foreach ($specificPrices AS $key => &$row) { $row['quantity'] = &$row['from_quantity']; // The price may be directly set if ($row['price'] != 0) { $cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $taxRate / 100)); if ($row['reduction_type'] == 'amount') $cur_price = Product::$_taxCalculationMethod == PS_TAX_INC ? $cur_price - $row['reduction'] : $cur_price - ($row['reduction'] / (1 + $taxRate / 100)); else $cur_price = $cur_price * ( 1 - ($row['reduction'])); $row['real_value'] = $price - $cur_price; } else { global $cookie; $id_currency = (int)$cookie->id_currency; if ($row['reduction_type'] == 'amount') { $reduction_amount = $row['reduction']; if (!$row['id_currency']) $reduction_amount = Tools::convertPrice($reduction_amount, $id_currency); $row['real_value'] = Product::$_taxCalculationMethod == PS_TAX_INC ? $reduction_amount : $reduction_amount / (1 + $taxRate / 100); } else { $row['real_value'] = $row['reduction'] * 100; } } $row['nextQuantity'] = (isset($specificPrices[$key + 1]) ? (int)($specificPrices[$key + 1]['from_quantity']) : -1); } return $specificPrices; }
Do podmínky if ($row[‚price‘] != 0) doplňte kód, viz úprava
Upravený kód:
public function formatQuantityDiscounts($specificPrices, $price, $taxRate) { foreach ($specificPrices AS $key => &$row) { $row['quantity'] = &$row['from_quantity']; // The price may be directly set if ($row['price'] != 0) { // upraveno, begin modified global $cookie; $id_currency = (int)$cookie->id_currency; if (($id_currency <> 0) AND ($id_currency <> Configuration::get('PS_CURRENCY_DEFAULT')) ) $cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? Tools::convertPrice($row['price'], $id_currency) : Tools::convertPrice($row['price'], $id_currency) * (1 + $taxRate / 100)); else // konec úpravy, end $cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $taxRate / 100)); if ($row['reduction_type'] == 'amount') $cur_price = Product::$_taxCalculationMethod == PS_TAX_INC ? $cur_price - $row['reduction'] : $cur_price - ($row['reduction'] / (1 + $taxRate / 100)); else $cur_price = $cur_price * ( 1 - ($row['reduction'])); $row['real_value'] = $price - $cur_price; } else { global $cookie; $id_currency = (int)$cookie->id_currency; if ($row['reduction_type'] == 'amount') { $reduction_amount = $row['reduction']; if (!$row['id_currency']) $reduction_amount = Tools::convertPrice($reduction_amount, $id_currency); $row['real_value'] = Product::$_taxCalculationMethod == PS_TAX_INC ? $reduction_amount : $reduction_amount / (1 + $taxRate / 100); } else { $row['real_value'] = $row['reduction'] * 100; } } $row['nextQuantity'] = (isset($specificPrices[$key + 1]) ? (int)($specificPrices[$key + 1]['from_quantity']) : -1); } return $specificPrices; }