From dc2bee57d4421dcabfc0a5fa42d1c1d8f0881be0 Mon Sep 17 00:00:00 2001 From: Dima Uryvskiy Date: Thu, 2 Apr 2020 16:35:35 +0300 Subject: [PATCH] Fix bug with option name (#179) fixes #178 ICML generation problem --- .gitignore | 1 + VERSION | 2 +- .../admin/model/extension/retailcrm/icml.php | 26 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c534094..4c2ef92 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /www /bin .env +composer.lock \ No newline at end of file diff --git a/VERSION b/VERSION index 86fb650..37d02a6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.7 +3.3.8 diff --git a/src/upload/admin/model/extension/retailcrm/icml.php b/src/upload/admin/model/extension/retailcrm/icml.php index a2a1979..c257b3c 100644 --- a/src/upload/admin/model/extension/retailcrm/icml.php +++ b/src/upload/admin/model/extension/retailcrm/icml.php @@ -136,11 +136,13 @@ class ModelExtensionRetailcrmIcml extends Model if ($optionString != '0:0-0') { $optionData = $this->getOptionData($optionIds[1], $option[1]); - $options[$optionIds[0]] = array( - 'name' => $optionData['optionName'], - 'value' => $optionData['optionValue'], - 'value_id' => $option[1] - ); + if (!empty($optionData)) { + $options[$optionIds[0]] = array( + 'name' => $optionData['optionName'], + 'value' => $optionData['optionValue'], + 'value_id' => $option[1] + ); + } } } @@ -247,7 +249,7 @@ class ModelExtensionRetailcrmIcml extends Model $productHeight = $product['height']; } - if ($defaultLenght['length_class_id'] != $settingLenght) { + if ($defaultLenght['length_class_id'] != $settingLenght && $settingLenght) { $unit = $this->model_localisation_length_class->getLengthClass($settingLenght); $productLength = $productLength * $unit['value']; $productWidth = $productWidth * $unit['value']; @@ -311,7 +313,7 @@ class ModelExtensionRetailcrmIcml extends Model $weight = $this->dd->createElement('param'); $weight->setAttribute('code', 'weight'); $weight->setAttribute('name', $this->language->get('weight')); - $weightValue = (isset($offer['weight_class'])) + $weightValue = (isset($product['weight_class'])) ? round($product['weight'], 3) . ' ' . $product['weight_class'] : round($product['weight'], 3) ; @@ -356,10 +358,12 @@ class ModelExtensionRetailcrmIcml extends Model $this->optionValues[$optionValueId] = $optionValue; } - return array( - 'optionName' => $option['name'], - 'optionValue' => $optionValue['name'] - ); + if (!empty($option['name']) || !empty($optionValue['name'])) { + return array( + 'optionName' => $option['name'], + 'optionValue' => $optionValue['name'] + ); + } } private function getDefaultCurrency() {