From f71002f4d69a3c8b09874aea58416212f2336d6b Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 7 Jun 2019 08:59:57 +0300 Subject: [PATCH] =?UTF-8?q?Closes:=20#157=20=D0=93=D0=B5=D0=BD=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B3=D0=B0=D0=B1=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ VERSION | 2 +- .../controller/extension/module/retailcrm.php | 7 ++- .../en-gb/extension/module/retailcrm.php | 2 + .../es-es/extension/module/retailcrm.php | 2 + .../ru-ru/extension/module/retailcrm.php | 2 + .../admin/model/extension/retailcrm/icml.php | 47 +++++++++++++++++++ .../template/extension/module/retailcrm.tpl | 15 ++++++ .../template/extension/module/retailcrm.twig | 15 ++++++ .../system/library/retailcrm/retailcrm.php | 15 ++++++ 10 files changed, 108 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eff403..46afdb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v.3.3.5 +* Добавлена генерация габаритов в каталоге + ## v.3.3.4 * Исправлен баг с некорректной выгрузкой акционных цен для товаров с характеристиками diff --git a/VERSION b/VERSION index a0891f5..fa7adc7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.4 +3.3.5 diff --git a/src/upload/admin/controller/extension/module/retailcrm.php b/src/upload/admin/controller/extension/module/retailcrm.php index 85ef039..a229c4f 100644 --- a/src/upload/admin/controller/extension/module/retailcrm.php +++ b/src/upload/admin/controller/extension/module/retailcrm.php @@ -120,6 +120,7 @@ class ControllerExtensionModuleRetailcrm extends Controller $this->load->model('extension/retailcrm/references'); $this->load->model('localisation/currency'); $this->load->model('customer/customer_group'); + $this->load->model('localisation/length_class'); $this->load->language('extension/module/retailcrm'); $this->document->setTitle($this->language->get('heading_title')); $this->document->addStyle('/admin/view/stylesheet/retailcrm.css'); @@ -306,7 +307,9 @@ class ControllerExtensionModuleRetailcrm extends Controller 'text_currency', 'text_currency_label', 'status_changes', - 'text_status_changes' + 'text_status_changes', + 'text_lenght', + 'text_lenght_label' ); $_data = &$data; @@ -344,6 +347,8 @@ class ControllerExtensionModuleRetailcrm extends Controller ->getCustomFields(); } + $_data['lenghts'] = $this->model_localisation_length_class->getLengthClasses(); + if ($apiVersion != 'v3') { $_data['priceTypes'] = $this->model_extension_retailcrm_references ->getPriceTypes(); diff --git a/src/upload/admin/language/en-gb/extension/module/retailcrm.php b/src/upload/admin/language/en-gb/extension/module/retailcrm.php index 768b332..75ea46a 100644 --- a/src/upload/admin/language/en-gb/extension/module/retailcrm.php +++ b/src/upload/admin/language/en-gb/extension/module/retailcrm.php @@ -70,6 +70,8 @@ $_['order_number'] = 'Order number'; $_['text_order_number'] = 'Upload the order number to retailCRM'; $_['text_currency'] = 'Currency setting'; $_['text_currency_label'] = 'Currency in ICML'; +$_['text_lenght'] = 'Setting of the unit of measurement'; +$_['text_lenght_label'] = 'Unit of measurement in ICML'; $_['status_changes'] = 'History of changes'; $_['text_status_changes'] = 'Record changes to the order history of Opencart'; diff --git a/src/upload/admin/language/es-es/extension/module/retailcrm.php b/src/upload/admin/language/es-es/extension/module/retailcrm.php index 06b9c46..b8d2060 100644 --- a/src/upload/admin/language/es-es/extension/module/retailcrm.php +++ b/src/upload/admin/language/es-es/extension/module/retailcrm.php @@ -70,6 +70,8 @@ $_['order_number'] = 'Número de pedido'; $_['text_order_number'] = 'Transferir número de pedido a retailCRM'; $_['text_currency'] = 'Ajustes de moneda'; $_['text_currency_label'] = 'Moneda en ICML'; +$_['text_lenght'] = 'Ajustar unidad de medida'; +$_['text_lenght_label'] = 'Unidad de medida en ICML'; $_['status_changes'] = 'Historial de cambios'; $_['text_status_changes'] = 'Registrar los cambios en el historial de pedidos de Opencart'; diff --git a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php index b84697b..a9817b3 100644 --- a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php +++ b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php @@ -70,6 +70,8 @@ $_['order_number'] = 'Номер заказа'; $_['text_order_number'] = 'Передавать номер заказа в retailCRM'; $_['text_currency'] = 'Настройка валюты'; $_['text_currency_label'] = 'Валюта в ICML'; +$_['text_lenght'] = 'Настройка единицы измерения'; +$_['text_lenght_label'] = 'Единица измерения в ICML'; $_['status_changes'] = 'История изменений'; $_['text_status_changes'] = 'Фиксировать изменения в истории заказа Opencart'; diff --git a/src/upload/admin/model/extension/retailcrm/icml.php b/src/upload/admin/model/extension/retailcrm/icml.php index d5030a5..a2a1979 100644 --- a/src/upload/admin/model/extension/retailcrm/icml.php +++ b/src/upload/admin/model/extension/retailcrm/icml.php @@ -31,6 +31,7 @@ class ModelExtensionRetailcrmIcml extends Model $this->load->model('catalog/product'); $this->load->model('catalog/option'); $this->load->model('catalog/manufacturer'); + $this->load->model('localisation/length_class'); $string = ' @@ -104,6 +105,14 @@ class ModelExtensionRetailcrmIcml extends Model $offerManufacturers = array(); $currencyForIcml = $this->retailcrm->getCurrencyForIcml(); $defaultCurrency = $this->getDefaultCurrency(); + $settingLenght = $this->retailcrm->getLenghtForIcml(); + $leghtsArray = $this->model_localisation_length_class->getLengthClasses(); + + foreach ($leghtsArray as $lenght) { + if ($lenght['value'] == 1) { + $defaultLenght = $lenght; + } + } $manufacturers = $this->model_catalog_manufacturer ->getManufacturers(array()); @@ -218,6 +227,44 @@ class ModelExtensionRetailcrmIcml extends Model ) ); } + + /** + * Dimensions + */ + if ((!empty($product['length']) && $product['length'] > 0) && + (!empty($product['width'] && $product['width'] > 0)) + && !empty($product['height'])) + { + $lenghtArray = $this->model_localisation_length_class->getLengthClass($product['length_class_id']); + + if ($defaultLenght['length_class_id'] != $lenghtArray['length_class_id']) { + $productLength = $product['length'] / $lenghtArray['value']; + $productWidth = $product['width'] / $lenghtArray['value']; + $productHeight = $product['height'] / $lenghtArray['value']; + } else { + $productLength = $product['length']; + $productWidth = $product['width']; + $productHeight = $product['height']; + } + + if ($defaultLenght['length_class_id'] != $settingLenght) { + $unit = $this->model_localisation_length_class->getLengthClass($settingLenght); + $productLength = $productLength * $unit['value']; + $productWidth = $productWidth * $unit['value']; + $productHeight = $productHeight * $unit['value']; + } + + $dimensions = sprintf( + '%01.3f/%01.3f/%01.3f', + $productLength, + $productWidth, + $productHeight + ); + + $e->appendChild($this->dd->createElement('dimensions')) + ->appendChild($this->dd->createTextNode($dimensions)); + } + /** * Image */ diff --git a/src/upload/admin/view/template/extension/module/retailcrm.tpl b/src/upload/admin/view/template/extension/module/retailcrm.tpl index 8151190..c7fd402 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.tpl +++ b/src/upload/admin/view/template/extension/module/retailcrm.tpl @@ -109,6 +109,21 @@ +
+ +
+ +
+ +
+
+
diff --git a/src/upload/admin/view/template/extension/module/retailcrm.twig b/src/upload/admin/view/template/extension/module/retailcrm.twig index 4cbbd26..90057bf 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.twig +++ b/src/upload/admin/view/template/extension/module/retailcrm.twig @@ -108,6 +108,21 @@
+
+ {{ text_lenght }} +
+ +
+ +
+
+
{{ status_changes }}
diff --git a/src/upload/system/library/retailcrm/retailcrm.php b/src/upload/system/library/retailcrm/retailcrm.php index e9df359..1e85153 100644 --- a/src/upload/system/library/retailcrm/retailcrm.php +++ b/src/upload/system/library/retailcrm/retailcrm.php @@ -179,4 +179,19 @@ class Retailcrm { return false; } + + /** + * @return mixed + */ + public function getLenghtForIcml() { + $this->load->model('setting/setting'); + + $setting = $this->model_setting_setting->getSetting($this->getModuleTitle()); + + if (isset($setting[$this->getModuleTitle() . '_lenght'])) { + return $setting[$this->getModuleTitle() . '_lenght']; + } + + return false; + } }