diff --git a/CHANGELOG.md b/CHANGELOG.md index 52b9cc8..a116c4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v.3.1.0 +* Переработан дизайн шаблона twig +* Добавлена настройка передачи номера заказа в retailCRM +* Улучшена механика передачи типа доставки в retailCRM +* Исправлена ошибка при выгрузке единичного заказа в админ панели + ## v.3.0.5 * Исправлены ошибки в шаблоне twig * Добавлена обработка истории изменений при сохранении настроек для установки текущего sinceId, если история в retailCRM пустая diff --git a/VERSION b/VERSION index 7da3c16..a0cd9f0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.5 \ No newline at end of file +3.1.0 \ No newline at end of file diff --git a/src/upload/admin/controller/extension/module/retailcrm.php b/src/upload/admin/controller/extension/module/retailcrm.php index 907e278..e4d19fd 100644 --- a/src/upload/admin/controller/extension/module/retailcrm.php +++ b/src/upload/admin/controller/extension/module/retailcrm.php @@ -249,7 +249,9 @@ class ControllerExtensionModuleRetailcrm extends Controller 'text_error_delivery', 'retailcrm_missing_status', 'special_price_settings', - 'special_price' + 'special_price', + 'order_number', + 'text_order_number' ); $_data = &$data; @@ -516,7 +518,8 @@ class ControllerExtensionModuleRetailcrm extends Controller $data['order_status'] = $status[$this->moduleTitle . '_status'][$data['order_status_id']]; $this->load->model('extension/retailcrm/order'); - $response = $this->model_extension_retailcrm_order->uploadOrder($data, $this->retailcrm->getApiClient()); + $this->model_extension_retailcrm_order->uploadOrder($data, $this->retailcrm->getApiClient()); + $response = $this->model_extension_retailcrm_order->getLastResponse(); } if (!$response->isSuccessful()) { 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 3e2f71c..3b7db86 100644 --- a/src/upload/admin/language/en-gb/extension/module/retailcrm.php +++ b/src/upload/admin/language/en-gb/extension/module/retailcrm.php @@ -66,6 +66,9 @@ $_['retailcrm_dict_custom_fields'] = 'Configure custom fields'; $_['retailcrm_dict_default'] = 'Default'; $_['retailcrm_missing_status'] = 'Missing orders status'; +$_['order_number'] = 'Order number'; +$_['text_order_number'] = 'Transfer order number to retailCRM'; + $_['column_total'] = 'Total'; $_['product_summ'] = 'Amount'; 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 a8dc9e6..cbfd9ee 100644 --- a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php +++ b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php @@ -66,6 +66,9 @@ $_['retailcrm_dict_custom_fields'] = 'Настройка пользовател $_['retailcrm_dict_default'] = 'По умолчанию'; $_['retailcrm_missing_status'] = 'Статус пропавших заказов'; +$_['order_number'] = 'Номер заказа'; +$_['text_order_number'] = 'Передавать номер заказа в retailCRM'; + $_['column_total'] = 'Итого'; $_['product_summ'] = 'Сумма'; diff --git a/src/upload/admin/model/extension/retailcrm/order.php b/src/upload/admin/model/extension/retailcrm/order.php index be872cc..feed665 100644 --- a/src/upload/admin/model/extension/retailcrm/order.php +++ b/src/upload/admin/model/extension/retailcrm/order.php @@ -115,11 +115,29 @@ class ModelExtensionRetailcrmOrder extends Model { } } + if (!isset($delivery_code) && isset($shippingModule)) { + $deliveries = array_keys($this->settings[$this->moduleTitle . '_delivery']); + $shipping_code = ''; + + array_walk($deliveries, function($item, $key) use ($shippingModule, &$shipping_code) { + if (strripos($item, $shippingModule) !== false) { + $shipping_code = $item; + } + }); + + $delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shipping_code]; + } + if (!empty($order_data['payment_iso_code_2'])) { $order['countryIso'] = $order_data['payment_iso_code_2']; } - $order['number'] = $order_data['order_id']; + if (isset($this->settings[$this->moduleTitle . '_order_number']) + && $this->settings[$this->moduleTitle . '_order_number'] == 1 + ) { + $order['number'] = $order_data['order_id']; + } + $order['externalId'] = $order_data['order_id']; $order['firstName'] = $order_data['firstname']; $order['lastName'] = $order_data['lastname']; diff --git a/src/upload/admin/view/template/extension/module/retailcrm.tpl b/src/upload/admin/view/template/extension/module/retailcrm.tpl index 9502ab7..5adffdf 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.tpl +++ b/src/upload/admin/view/template/extension/module/retailcrm.tpl @@ -50,7 +50,7 @@
- +
@@ -75,7 +75,7 @@
- +
@@ -99,7 +99,7 @@
- +
@@ -113,10 +113,10 @@
-
+
- +
@@ -133,10 +133,30 @@
+
+ +
+ +
+ + +
+
+
- +
@@ -238,7 +258,7 @@
-
+
/> -
+
@@ -380,7 +400,7 @@
- +
@@ -399,7 +419,7 @@
-
+
@@ -468,7 +488,7 @@
- Retailcrm API error log + Retailcrm API error log @@ -485,7 +505,7 @@
- Opencart API error log + Opencart API error log diff --git a/src/upload/admin/view/template/extension/module/retailcrm.twig b/src/upload/admin/view/template/extension/module/retailcrm.twig index 41c9735..25062be 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.twig +++ b/src/upload/admin/view/template/extension/module/retailcrm.twig @@ -1,5 +1,4 @@ {{ header }} {{ column_left }} -
+
+ {{ retailcrm_countries_settings }} +
+ +
+
+ {% for country in countries %} +
+ +
+ {% endfor %} +
+
+
+
{% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %} - {% if retailcrm_errors|length %} {% for retailcrm_error in retailcrm_errors %}
{{ retailcrm_error }}
{% endfor %} {% else %} -

{{ retailcrm_upload_order }}

-
- - -
- {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %} -

{{ special_price_settings }}

-
- - -
- {% endif %} -
- -
-

{{ retailcrm_dict_settings }}

- -

{{ retailcrm_dict_delivery }}

- {% for value in delivery.opencart %} - -
{{ value.title ~ ':' }}
- - {% for key, val in value %} - {% if key != 'title' %} -
- - +
+ {{ retailcrm_upload_order }} +
+ +
+
+
+ +
+
+ +
+
- {% endif %} - {% endfor %} - {% endfor %} - -

{{ retailcrm_dict_status }}

- {% for status in statuses.opencart %} - {% set uid = status.order_status_id %} -
- - -
- {% endfor %} - -

{{ retailcrm_dict_payment }}

- {% for key, value in payments.opencart %} -
- - -
- {% endfor %} -

{{ retailcrm_dict_default }}

-
- - -
-
- - -
-

{{ retailcrm_missing_status }}

-
- -
- {% endif %} - - {% endif %} -
- -
-

{{ daemon_collector }}

-
- - - -
-
- - -
-
- - - -
-
- - -
-
- - -
-
- - -
-
- - - -
- {% for field, label in collectorFields %} -
- -
- - -
-
- {% endfor %} -
- {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion == 'v5' and customFields is defined %} -
-

{{ retailcrm_dict_custom_fields }}

- {% if customFields.retailcrm is not empty and customFields.opencart is not empty %} -
- -
+ {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %} +
+ {{ special_price_settings }} +
+ +
+ +
+
+
+ {% endif %} +
+ {{ order_number }} +
+ +
+ -
-

{{ text_customers_custom_fields }}

- {% for customField in customFields.opencart %} - {% set fid = 'c_' ~ customField.custom_field_id %} -
- - +
+
+
+
+
+ {{ retailcrm_dict_settings }} +
+ +
+
+ {% if delivery.opencart is not empty %} + {% for value in delivery.opencart %} +
+
{{ value.title ~ ':' }}
+ {% for key, val in value %} + {% if key != 'title' %} +
+
+ +
+
+ +
+
+ {% endif %} + {% endfor %} +
+ {% endfor %} + {% else %} +
+ + {{ text_error_delivery }} +
+ {% endif %}
- {% endfor %} -

{{ text_orders_custom_fields }}

- {% for customField in customFields.opencart %} - {% set fid = 'o_' ~ customField.custom_field_id %} -
- - +
+
+
+ +
+ {% for status in statuses.opencart %} + {% set uid = status.order_status_id %} +
+
+ +
+
+ +
- {% endfor %} - {% elseif customFields.retailcrm is empty and customFields.opencart is empty %} -
- - {{ text_error_custom_field }} + {% endfor %}
- {% elseif customFields.retailcrm is empty %} -
- - {{ text_error_cf_retailcrm }} +
+
+ +
+ {% for key, value in payments.opencart %} +
+
+ +
+
+ +
+
+ {% endfor %}
- {% elseif customFields.opencart is empty %} -
- - {{ text_error_cf_opencart }} +
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
- {% endif %} +
+
+ +
+
+
+ +
+
+
+
+
+ {% endif %} + {% endif %} +
+
+
+ {{ daemon_collector }} +
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ {% for field, label in collectorFields %} +
+ +
+
+
+ +
+
+ + +
+
+
+
+ {% endfor %} +
+
+ {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion == 'v5' and customFields is defined %} +
+
+ {{ retailcrm_dict_custom_fields }} + {% if customFields.retailcrm is not empty and customFields.opencart is not empty %} +
+ +
+ + +
+
+
+ +
+
+ {% for customField in customFields.opencart %} +
+
+ {% set fid = 'c_' ~ customField.custom_field_id %} +
+ +
+ +
+
+ {% endfor %} +
+
+
+
+ +
+
+ {% for customField in customFields.opencart %} +
+
+ {% set fid = 'o_' ~ customField.custom_field_id %} +
+ +
+ +
+
+ {% endfor %} +
+
+
+ {% elseif customFields.retailcrm is empty and customFields.opencart is empty %} +
+ + {{ text_error_custom_field }} +
+ {% elseif customFields.retailcrm is empty %} +
+ + {{ text_error_cf_retailcrm }} +
+ {% elseif customFields.opencart is empty %} +
+ + {{ text_error_cf_opencart }} +
+ {% endif %} +
{% endif %}
-
- Retailcrm API error log - -
- {% if logs.retailcrm_log is defined %} -
- +
+ Retailcrm API error log +
+
- {% elseif logs.retailcrm_error is defined %} -
{{ logs.retailcrm_error }} - + {% if logs.retailcrm_log is defined %} +
+
+ +
- {% endif %} -
- Opencart API error log - -
- {% if logs.oc_api_log is defined %} -
- + {% elseif logs.retailcrm_error is defined %} +
{{ logs.retailcrm_error }} + +
+ {% endif %} +
+
+ Opencart API error log +
+
- {% elseif logs.oc_error is defined %} -
{{ logs.oc_error }} - + {% if logs.oc_api_log is defined %} +
+
+ +
- {% endif %} + {% elseif logs.oc_error is defined %} +
{{ logs.oc_error }} + +
+ {% endif %} +
@@ -382,7 +531,6 @@
- {{ footer }}