[-] FO: Fix ecotax displayed on the quantity discounts tab with a change of base_price on the product page
This commit is contained in:
@@ -2884,6 +2884,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$this->displayWarning($this->l('You must save this product before adding specific pricing'));
|
||||
$product->id_tax_rules_group = (int)Product::getIdTaxRulesGroupMostUsed();
|
||||
$data->assign('ecotax_tax_excl', 0);
|
||||
}
|
||||
|
||||
// prices part
|
||||
@@ -2895,7 +2896,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
'ecotaxTaxRate' => Tax::getProductEcotaxRate(),
|
||||
'tax_exclude_taxe_option' => Tax::excludeTaxeOption(),
|
||||
'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX'),
|
||||
'ecotax_tax_excl' => 0
|
||||
));
|
||||
|
||||
$product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context);
|
||||
|
||||
@@ -320,7 +320,7 @@ class ProductControllerCore extends FrontController
|
||||
$product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false);
|
||||
$address = new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$this->context->smarty->assign(array(
|
||||
'quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax),
|
||||
'quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax, $ecotax_tax_amount),
|
||||
'ecotax_tax_inc' => $ecotax_tax_amount,
|
||||
'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2),
|
||||
'ecotaxTax_rate' => $ecotax_rate,
|
||||
@@ -590,14 +590,14 @@ class ProductControllerCore extends FrontController
|
||||
$this->context->smarty->assign('customizationFormTarget', $customization_form_target);
|
||||
}
|
||||
|
||||
protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate)
|
||||
protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate, $ecotax_amount)
|
||||
{
|
||||
foreach ($specific_prices as $key => &$row)
|
||||
{
|
||||
$row['quantity'] = &$row['from_quantity'];
|
||||
if ($row['price'] >= 0) // The price may be directly set
|
||||
{
|
||||
$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100));
|
||||
$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100)) + (float)$ecotax_amount;
|
||||
if ($row['reduction_type'] == 'amount')
|
||||
$cur_price -= (Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100));
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user