From eb832120945ae9fb16c48de40fada9ddc012b1c4 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 17 May 2019 15:05:37 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=82=D0=B8=D0=BF=D0=B0=20=D1=86=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=B0=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BD=D0=B5=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B0=D0=BA=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85=20=D1=86=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ VERSION | 2 +- .../admin/model/extension/retailcrm/prices.php | 14 +++++++++----- tests/admin/ModelRetailcrmPricesAdminTest.php | 4 +++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e49290c..2eeb26a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v.3.3.3 +* Добавлено удаление типа цены товара для неустановленных акционных цен + ## v.3.3.2 * Добавлен возврат остатка товара при отмене заказа diff --git a/VERSION b/VERSION index 4772543..619b537 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.2 +3.3.3 diff --git a/src/upload/admin/model/extension/retailcrm/prices.php b/src/upload/admin/model/extension/retailcrm/prices.php index 20a0fb1..f5047fd 100644 --- a/src/upload/admin/model/extension/retailcrm/prices.php +++ b/src/upload/admin/model/extension/retailcrm/prices.php @@ -129,10 +129,12 @@ class ModelExtensionRetailcrmPrices extends Model $price = array(); foreach($productPrice as $k => $v) { + if (isset($this->settings[$this->moduleTitle . '_special_' . $k])) { $price[] = array( 'code' => $this->settings[$this->moduleTitle . '_special_' . $k], - 'price' => $v == 0 ? $v : $v + $optionsValues['price'] + 'price' => !$v['remove'] ? $v['price'] + $optionsValues['price'] : 0, + 'remove' => $v['remove'] ); } } @@ -168,13 +170,15 @@ class ModelExtensionRetailcrmPrices extends Model if ((isset($priority) && $priority > $special['priority']) || !isset($priority) ) { - $productPrice[$special['customer_group_id']] = $special['price']; + $productPrice[$special['customer_group_id']]['price'] = $special['price']; + $productPrice[$special['customer_group_id']]['remove'] = false; $priority = $special['priority']; $groupId = $special['customer_group_id']; } } else { - $productPrice[$special['customer_group_id']] = $special['price']; + $productPrice[$special['customer_group_id']]['price'] = $special['price']; $groupId = $special['customer_group_id']; + $productPrice[$special['customer_group_id']]['remove'] = false; } } } @@ -183,7 +187,7 @@ class ModelExtensionRetailcrmPrices extends Model foreach ($customerGroups as $customerGroup) { if (!isset($productPrice[$customerGroup['customer_group_id']])){ - $productPrice[$customerGroup['customer_group_id']] = 0; + $productPrice[$customerGroup['customer_group_id']]['remove'] = true; } } @@ -201,7 +205,7 @@ class ModelExtensionRetailcrmPrices extends Model $productPrice = array(); foreach ($customerGroups as $customerGroup) { - $productPrice[$customerGroup['customer_group_id']] = 0; + $productPrice[$customerGroup['customer_group_id']]['remove'] = true; } return $productPrice; diff --git a/tests/admin/ModelRetailcrmPricesAdminTest.php b/tests/admin/ModelRetailcrmPricesAdminTest.php index 7a7ad01..808e13e 100644 --- a/tests/admin/ModelRetailcrmPricesAdminTest.php +++ b/tests/admin/ModelRetailcrmPricesAdminTest.php @@ -62,7 +62,9 @@ class ModelRetailcrmPricesAdminTest extends OpenCartTest $this->assertEquals('special1', $price['prices'][0]['code']); $this->assertEquals('special2', $price['prices'][1]['code']); $this->assertEquals('special3', $price['prices'][2]['code']); - $this->assertEquals(0, $price['prices'][2]['price']); + $this->assertFalse($price['prices'][0]['remove']); + $this->assertFalse($price['prices'][1]['remove']); + $this->assertNotFalse($price['prices'][2]['remove']); } private function sites(){