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; + } }