From 30ea30c6f4e0169a17858ca10f7a6bc26ddc0c61 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Mon, 16 Jul 2012 08:29:59 +0000 Subject: [PATCH] [-] Core: Fix PSCFV-3161 storage specific prices in orders git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16432 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/SpecificPrice.php | 10 +++++----- classes/order/OrderDetail.php | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php index 7c5068878..693f92201 100644 --- a/classes/SpecificPrice.php +++ b/classes/SpecificPrice.php @@ -295,16 +295,16 @@ class SpecificPriceCore extends ObjectModel '); $targeted_prices = array(); - $last_quantity = null; + $last_quantity = array(); foreach ($res as $specific_price) { - if (!isset($last_quantity)) - $last_quantity = $specific_price['from_quantity']; - else if ($last_quantity == $specific_price['from_quantity']) + if (!isset($last_quantity[(int)$specific_price['id_product_attribute']])) + $last_quantity[(int)$specific_price['id_product_attribute']] = $specific_price['from_quantity']; + elseif ($last_quantity[(int)$specific_price['id_product_attribute']] == $specific_price['from_quantity']) 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) $targeted_prices[] = $specific_price; } diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index 58607015e..3997acacc 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -424,6 +424,8 @@ class OrderDetailCore extends ObjectModel { $this->reduction_amount = 0.00; $this->reduction_percent = 0.00; + $this->reduction_amount_tax_incl = 0.00; + $this->reduction_amount_tax_excl = 0.00; if ($this->specificPrice) switch ($this->specificPrice['reduction_type']) @@ -435,9 +437,9 @@ class OrderDetailCore extends ObjectModel case 'amount': $price = Tools::convertPrice($this->specificPrice['reduction'], $order->id_currency); $this->reduction_amount = (float)(!$this->specificPrice['id_currency'] ? - $price : $this->specificPrice['reduction']); - $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); + $price : $this->specificPrice['reduction']); + $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); break; } }