From acb92e9746aa4383b4a3b2bcd08f6f05b5564c0b Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Tue, 2 Feb 2016 15:09:56 +0200 Subject: [PATCH] CartCalculator::updatePositions fixed getting position ID --- src/cart/CartCalculator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cart/CartCalculator.php b/src/cart/CartCalculator.php index 88831fcc..ffec7d83 100644 --- a/src/cart/CartCalculator.php +++ b/src/cart/CartCalculator.php @@ -106,13 +106,14 @@ private function sendRequest($data) */ private function updatePositions($data) { - foreach ($this->cart->positions as $id => $position) { + foreach ($this->cart->positions as $position) { + $id = $position->id; if (isset($data[$id])) { $value = reset($data[$id]['value']); // data is wrapped with currency. todo: dynamic currencies $position->setPrice($value['price']); $position->setValue($value['value']); } else { - Yii::warning('Cart position was removed from the cart because of failed value calculation', 'hipanel.cart'); + Yii::error('Cart position was removed from the cart because of failed value calculation. Normally this should never happen.', 'hipanel.cart'); $this->cart->removeById($position->id); break; } @@ -134,4 +135,4 @@ protected function getCalculationModels() return $models; } -} \ No newline at end of file +}