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 @@