From 5e6c30837541f2f1bedbbbba6021601bbbe69641 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 7 Jun 2019 14:37:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B3=D0=B0=D0=B1=D0=B0=D1=80=D0=B8=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B2=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ .../controller/extension/module/retailcrm.php | 8 +++- .../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 | 48 +++++++++++++++++++ .../template/extension/module/retailcrm.twig | 15 ++++++ .../system/library/retailcrm/retailcrm.php | 15 ++++++ 8 files changed, 93 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73b526f..5869ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v.3.1.5 +* Добавлена генерация габаритов в катало + ## v.3.1.4 * Добавлено удаление типа цены для неустановленных акционных цен diff --git a/src/upload/admin/controller/extension/module/retailcrm.php b/src/upload/admin/controller/extension/module/retailcrm.php index da23081..f9d4117 100644 --- a/src/upload/admin/controller/extension/module/retailcrm.php +++ b/src/upload/admin/controller/extension/module/retailcrm.php @@ -96,6 +96,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { $this->load->model('setting/setting'); $this->load->model('extension/retailcrm/references'); $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'); @@ -219,7 +220,9 @@ class ControllerExtensionModuleRetailcrm extends Controller { 'order_number', 'text_order_number', 'debug', - 'text_debug' + 'text_debug', + 'text_lenght', + 'text_lenght_label' ); foreach ($text_strings as $text) { @@ -250,8 +253,9 @@ class ControllerExtensionModuleRetailcrm extends Controller { $_data['customFields'] = $this->model_extension_retailcrm_references ->getCustomFields($retailcrm_api_client); $_data['priceTypes'] = $this->model_extension_retailcrm_references - ->getPriceTypes(); + ->getPriceTypes($retailcrm_api_client); $_data['customerGroups'] = $this->model_customer_customer_group->getCustomerGroups(); + $_data['lenghts'] = $this->model_localisation_length_class->getLengthClasses(); } $config_data = array( 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 597e11b..2752c1f 100644 --- a/src/upload/admin/language/en-gb/extension/module/retailcrm.php +++ b/src/upload/admin/language/en-gb/extension/module/retailcrm.php @@ -59,6 +59,8 @@ $_['text_error_save'] = 'Error when saving settings'; $_['text_error_log'] = 'Log size is more than 2MB'; $_['text_error_delivery'] = 'Delivery types are not found'; $_['text_confirm_log'] = 'Are you sure that you want to clear the log?'; +$_['text_lenght'] = 'Setting of the unit of measurement'; +$_['text_lenght_label'] = 'Unit of measurement in ICML'; $_['retailcrm_dict_delivery'] = 'Delivery types'; $_['retailcrm_dict_status'] = 'Statuses'; 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 929a9bc..e74ae41 100644 --- a/src/upload/admin/language/es-es/extension/module/retailcrm.php +++ b/src/upload/admin/language/es-es/extension/module/retailcrm.php @@ -58,6 +58,8 @@ $_['text_error_save'] = 'Error al guardar la configuración'; $_['text_error_log'] = 'El Tamaño del registro es más de 2MB'; $_['text_error_delivery'] = 'No se encontraron los métodos de envío'; $_['text_confirm_log'] = '¿Estás seguro de que quieres borrar el registro?'; +$_['text_lenght_label'] = 'Ajustar unidad de medida'; +$_['status_changes'] = 'Unidad de medida en ICML'; $_['retailcrm_dict_delivery'] = 'Métodos de envío'; $_['retailcrm_dict_status'] = 'Estados'; 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 8556707..f7b5089 100644 --- a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php +++ b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php @@ -58,6 +58,8 @@ $_['text_error_save'] = 'Ошибка сохранения настр $_['text_error_log'] = 'Размер лога более 2MB'; $_['text_error_delivery'] = 'Не найдены типы доставки'; $_['text_confirm_log'] = 'Вы уверены, что хотите очистить лог?'; +$_['text_lenght'] = 'Единица измерения в ICML'; +$_['text_lenght_label'] = 'История изменений'; $_['retailcrm_dict_delivery'] = 'Способы доставки'; $_['retailcrm_dict_status'] = 'Статусы'; diff --git a/src/upload/admin/model/extension/retailcrm/icml.php b/src/upload/admin/model/extension/retailcrm/icml.php index 3efd10d..42866f5 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 = ' @@ -101,6 +102,15 @@ class ModelExtensionRetailcrmIcml extends Model $manufacturers = $this->model_catalog_manufacturer ->getManufacturers(array()); + $settingLenght = $this->retailcrm->getLenghtForIcml(); + $leghtsArray = $this->model_localisation_length_class + ->getLengthClasses(); + + foreach ($leghtsArray as $lenght) { + if ($lenght['value'] == 1) { + $defaultLenght = $lenght; + } + } foreach ($manufacturers as $manufacturer) { $offerManufacturers[ @@ -203,6 +213,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.twig b/src/upload/admin/view/template/extension/module/retailcrm.twig index 53695ec..ae03971 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.twig +++ b/src/upload/admin/view/template/extension/module/retailcrm.twig @@ -113,6 +113,21 @@ +
+ {{ text_lenght }} +
+ +
+ +
+
+
{% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %}
{{ special_price_settings }} diff --git a/src/upload/system/library/retailcrm/retailcrm.php b/src/upload/system/library/retailcrm/retailcrm.php index 8edc9a0..4bcc5ea 100644 --- a/src/upload/system/library/retailcrm/retailcrm.php +++ b/src/upload/system/library/retailcrm/retailcrm.php @@ -171,4 +171,19 @@ class Retailcrm { return $haystack; } + + /** + * @return mixed + */ + public function getLenghtForIcml() { + $this->load->model('setting/setting'); + + $setting = $this->model_setting_setting->getSetting(self::MODULE); + + if (isset($setting[self::MODULE . '_lenght'])) { + return $setting[self::MODULE . '_lenght']; + } + + return false; + } }