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(){