[-] Core: Fix PSCFV-3161 storage specific prices in orders

This commit is contained in:
rGaillard
2012-07-16 08:29:59 +00:00
parent bf182c5da0
commit 222db03651
2 changed files with 10 additions and 8 deletions
+5 -5
View File
@@ -295,16 +295,16 @@ class SpecificPriceCore extends ObjectModel
'); ');
$targeted_prices = array(); $targeted_prices = array();
$last_quantity = null; $last_quantity = array();
foreach ($res as $specific_price) foreach ($res as $specific_price)
{ {
if (!isset($last_quantity)) if (!isset($last_quantity[(int)$specific_price['id_product_attribute']]))
$last_quantity = $specific_price['from_quantity']; $last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
else if ($last_quantity == $specific_price['from_quantity']) elseif ($last_quantity[(int)$specific_price['id_product_attribute']] == $specific_price['from_quantity'])
break; break;
$last_quantity = $specific_price['from_quantity']; $last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity'];
if ($specific_price['from_quantity'] > 1) if ($specific_price['from_quantity'] > 1)
$targeted_prices[] = $specific_price; $targeted_prices[] = $specific_price;
} }
+5 -3
View File
@@ -424,6 +424,8 @@ class OrderDetailCore extends ObjectModel
{ {
$this->reduction_amount = 0.00; $this->reduction_amount = 0.00;
$this->reduction_percent = 0.00; $this->reduction_percent = 0.00;
$this->reduction_amount_tax_incl = 0.00;
$this->reduction_amount_tax_excl = 0.00;
if ($this->specificPrice) if ($this->specificPrice)
switch ($this->specificPrice['reduction_type']) switch ($this->specificPrice['reduction_type'])
@@ -435,9 +437,9 @@ class OrderDetailCore extends ObjectModel
case 'amount': case 'amount':
$price = Tools::convertPrice($this->specificPrice['reduction'], $order->id_currency); $price = Tools::convertPrice($this->specificPrice['reduction'], $order->id_currency);
$this->reduction_amount = (float)(!$this->specificPrice['id_currency'] ? $this->reduction_amount = (float)(!$this->specificPrice['id_currency'] ?
$price : $this->specificPrice['reduction']); $price : $this->specificPrice['reduction']);
$this->reduction_amount_tax_incl = $this->reduction_amount; $this->reduction_amount_tax_incl = $this->reduction_amount;
$this->reduction_amount_tax_excl = Tools::ps_round($this->tax_calculator->removeTaxes($this->reduction_amount_tax_incl), 2); $this->reduction_amount_tax_excl = Tools::ps_round($this->tax_calculator->removeTaxes($this->reduction_amount_tax_incl), 2);
break; break;
} }
} }