diff --git a/admin/controller/extension/module/retailcrm.php b/admin/controller/extension/module/retailcrm.php index f4595fc..2af82fb 100644 --- a/admin/controller/extension/module/retailcrm.php +++ b/admin/controller/extension/module/retailcrm.php @@ -195,7 +195,14 @@ class ControllerExtensionModuleRetailcrm extends Controller 'collector_tab_text', 'text_yes', 'text_no', - 'collector_site_key' + 'collector_site_key', + 'text_collector_activity', + 'text_collector_form_capture', + 'text_collector_period', + 'text_label_promo', + 'text_label_send', + 'collector_custom_text', + 'text_require' ); $this->load->model('extension/extension'); @@ -245,8 +252,14 @@ class ControllerExtensionModuleRetailcrm extends Controller } } - if (isset($this->error['warning'])) { - $_data['error_warning'] = $this->error['warning']; + if (isset($this->_error['warning'])) { + $_data['error_warning'] = $this->_error['warning']; + } else { + $_data['error_warning'] = ''; + } + + if (isset($this->_error['fields'])) { + $_data['error_warning'] = $this->_error['fields']; } else { $_data['error_warning'] = ''; } @@ -314,6 +327,14 @@ class ControllerExtensionModuleRetailcrm extends Controller $_data['export_file'] = true; } + $collectorFields = array( + 'name' => $this->language->get('field_name'), + 'email' => $this->language->get('field_email'), + 'phone' => $this->language->get('field_phone') + ); + + $_data['collectorFields'] = $collectorFields; + $this->response->setOutput( $this->load->view('extension/module/retailcrm.tpl', $_data) ); @@ -486,6 +507,15 @@ class ControllerExtensionModuleRetailcrm extends Controller $this->_error['warning'] = $this->language->get('error_permission'); } + if (isset($this->request->post['retailcrm_collector']['custom']) && + $this->request->post['retailcrm_collector']['custom_form'] == 1) { + $customField = $this->request->post['retailcrm_collector']['custom']; + + if (empty($customField['name']) && empty($customField['email']) && empty($customField['phone'])) { + $this->_error['fields'] = $this->language->get('text_error_collector_fields'); + } + } + if (!$this->_error) { return true; } else { diff --git a/admin/language/en-gb/extension/module/retailcrm.php b/admin/language/en-gb/extension/module/retailcrm.php index 3ba4800..3e55368 100644 --- a/admin/language/en-gb/extension/module/retailcrm.php +++ b/admin/language/en-gb/extension/module/retailcrm.php @@ -16,6 +16,7 @@ $_['daemon_collector'] = 'Daemon Collector'; $_['general_tab_text'] = 'General'; $_['references_tab_text'] = 'References'; $_['collector_tab_text'] = 'Collector'; +$_['collector_custom_text'] = 'Custom form'; $_['retailcrm_url'] = 'RetailCRM URL'; $_['retailcrm_apikey'] = 'RetailCRM API Key'; @@ -29,6 +30,16 @@ $_['text_button_catalog'] = 'Unload catalog'; $_['text_success_catalog'] = 'Catalog successfully unloaded'; $_['text_error_order'] = 'Error! Order is not unloaded!'; $_['text_error_order_id'] = 'Error! Enter the correct order number!'; +$_['text_collector_activity'] = 'Use Daemon Collector'; +$_['text_collector_form_capture']= 'Show capture form'; +$_['text_collector_period'] = 'Form show period (in minutes)'; +$_['text_label_promo'] = 'Text form title'; +$_['text_label_send'] = 'Text button'; +$_['field_name'] = 'Name'; +$_['field_email'] = 'Email'; +$_['field_phone'] = 'Phone'; +$_['text_require'] = 'Require'; +$_['text_error_collector_fields']= 'Fill in the field names Daemon Collector'; $_['retailcrm_dict_delivery'] = 'Shipment methods'; $_['retailcrm_dict_status'] = 'Order statuses'; diff --git a/admin/language/ru-ru/extension/module/retailcrm.php b/admin/language/ru-ru/extension/module/retailcrm.php index 9b6c7c6..0c99f25 100644 --- a/admin/language/ru-ru/extension/module/retailcrm.php +++ b/admin/language/ru-ru/extension/module/retailcrm.php @@ -16,6 +16,7 @@ $_['daemon_collector'] = 'Демон Collector'; $_['general_tab_text'] = 'Главная'; $_['references_tab_text'] = 'Справочники'; $_['collector_tab_text'] = 'Collector'; +$_['collector_custom_text'] = 'Настройка полей формы'; $_['retailcrm_url'] = 'Адрес RetailCRM'; $_['retailcrm_apikey'] = 'Api ключ RetailCRM'; @@ -29,7 +30,16 @@ $_['text_button_catalog'] = 'Выгрузить каталог'; $_['text_success_catalog'] = 'Каталог успешно выгружен'; $_['text_error_order'] = 'Ошибка! Заказ не выгружен!'; $_['text_error_order_id'] = 'Ошибка! Введите корректный номер заказа!'; - +$_['text_collector_activity'] = 'Использовать Демон Collector'; +$_['text_collector_form_capture']= 'Показывать форму захвата'; +$_['text_collector_period'] = 'Периодичность всплывания формы (в минутах)'; +$_['text_label_promo'] = 'Текст заголовка формы'; +$_['text_label_send'] = 'Текст кнопки'; +$_['field_name'] = 'Имя'; +$_['field_email'] = 'Email'; +$_['field_phone'] = 'Телефон'; +$_['text_require'] = 'Обязательно для заполнения'; +$_['text_error_collector_fields']= 'Заполните названия полей формы Демон Collector'; $_['retailcrm_dict_delivery'] = 'Способы доставки'; $_['retailcrm_dict_status'] = 'Статусы'; diff --git a/admin/view/stylesheet/retailcrm.css b/admin/view/stylesheet/retailcrm.css index 5c3b88f..2efb7ae 100644 --- a/admin/view/stylesheet/retailcrm.css +++ b/admin/view/stylesheet/retailcrm.css @@ -1,3 +1,4 @@ .retailcrm_unit {margin-bottom: 10px;} .retailcrm_unit input {width: 30%;} .checkbox input{width: auto;} +.retailcrm_unit input[type=checkbox] {width: 13px;} \ No newline at end of file diff --git a/admin/view/template/extension/module/retailcrm.tpl b/admin/view/template/extension/module/retailcrm.tpl index a2768c7..6ee4124 100644 --- a/admin/view/template/extension/module/retailcrm.tpl +++ b/admin/view/template/extension/module/retailcrm.tpl @@ -38,7 +38,6 @@
-
-

- +

-
- - + + + +
+
+ + +
+ +
+ + + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + $label) : ?> +
+ +
+ + > +
- -
-
- -
+ + + +
- -
diff --git a/catalog/controller/extension/analytics/daemon_collector.php b/catalog/controller/extension/analytics/daemon_collector.php index 23ac623..a8278d3 100644 --- a/catalog/controller/extension/analytics/daemon_collector.php +++ b/catalog/controller/extension/analytics/daemon_collector.php @@ -1,19 +1,78 @@ config->get('retailcrm_collector_site_key'); + $this->load->model('setting/setting'); + + $settings = $this->model_setting_setting->getSetting('retailcrm'); + $setting = $settings['retailcrm_collector']; + $siteCode = isset($setting['site_key']) ? $setting['site_key'] : ''; if ($this->customer->isLogged()) $customerId = $this->customer->getID(); $customer = isset($customerId) ? "'customerId': '" . $customerId . "'" : ""; + $labelPromo = !empty($setting['label_promo']) ? $setting['label_promo'] : null; + $labelSend = !empty($setting['label_send']) ? $setting['label_send'] : null; + $customForm = ''; - $js = ""; diff --git a/catalog/controller/extension/module/retailcrm.php b/catalog/controller/extension/module/retailcrm.php index 7222576..20efee9 100644 --- a/catalog/controller/extension/module/retailcrm.php +++ b/catalog/controller/extension/module/retailcrm.php @@ -43,11 +43,6 @@ class ControllerExtensionModuleRetailcrm extends Controller $data['order_status'] = $status['retailcrm_status'][$data['order_status_id']]; } - $data['totals'][] = array( - 'code' => 'shipping', - 'value' => $this->session->data['shipping_method']['cost'] - ); - $this->load->model('extension/retailcrm/order'); $this->model_extension_retailcrm_order->sendToCrm($data, $data['order_id']); } diff --git a/catalog/model/extension/retailcrm/order.php b/catalog/model/extension/retailcrm/order.php index 55f5ddb..de2973e 100644 --- a/catalog/model/extension/retailcrm/order.php +++ b/catalog/model/extension/retailcrm/order.php @@ -204,8 +204,13 @@ class ModelExtensionRetailcrmOrder extends Model { if ($totals['code'] == 'shipping') { $deliveryCost = $totals['value']; } + + if ($totals['code'] == 'coupon') { + $couponTotal = abs($totals['value']); + } } + $order['discount'] = $couponTotal; $order['createdAt'] = $order_data['date_added']; $order['paymentType'] = $settings['retailcrm_payment'][$payment_code];