diff --git a/README.md b/README.md index 417fc0e..216764c 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ cp -r opencart-module/* /path/to/site/root Add to cron: ``` -*/5 * * * * /usr/bin/php /path/to/opencart/system/cron/history.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1 +*/5 * * * * /usr/bin/php /path/to/opencart/system/cron/history.php >> /path/to/opencart/system/storage/logs/cronjob_history.log 2>&1 ``` #### Setting product catalog export @@ -42,7 +42,7 @@ Add to cron: Add to cron: ``` -* */4 * * * /usr/bin/php /path/to/opencart/system/cron/icml.php >> /path/to/opencart/system/logs/cronjob_icml.log 2>&1 +* */4 * * * /usr/bin/php /path/to/opencart/system/cron/icml.php >> /path/to/opencart/system/storage/logs/cronjob_icml.log 2>&1 ``` Your export file will be available by following url diff --git a/README.ru.md b/README.ru.md index 0e5d119..b3b4f46 100644 --- a/README.ru.md +++ b/README.ru.md @@ -37,7 +37,7 @@ cp -r opencart-module/* /path/to/site/root Для получения изменений и новых данных добавьте в cron следующую запись: ``` -*/5 * * * * /usr/bin/php /path/to/opencart/system/cron/history.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1 +*/5 * * * * /usr/bin/php /path/to/opencart/system/cron/history.php >> /path/to/opencart/system/storage/logs/cronjob_history.log 2>&1 ``` #### Настройка экспорта каталога @@ -45,7 +45,7 @@ cp -r opencart-module/* /path/to/site/root Для периодической выгрузки каталога добавьте в cron следующую запись: ``` -* */4 * * * /usr/bin/php /path/to/opencart/system/cron/icml.php >> /path/to/opencart/system/logs/cronjob_icml.log 2>&1 +* */4 * * * /usr/bin/php /path/to/opencart/system/cron/icml.php >> /path/to/opencart/system/storage/logs/cronjob_icml.log 2>&1 ``` В настройках CRM установите путь к файлу выгрузки diff --git a/admin/model/extension/retailcrm/history.php b/admin/model/extension/retailcrm/history.php index eb19ffb..5e61bad 100644 --- a/admin/model/extension/retailcrm/history.php +++ b/admin/model/extension/retailcrm/history.php @@ -227,6 +227,15 @@ class ModelExtensionRetailcrmHistory extends Model $deliveryCost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : 0; + if(isset($order['discount']) && $order['discount'] > 0) { + $orderTotals = $this->model_sale_order->getOrderTotals($order['externalId']); + foreach($orderTotals as $orderTotal) { + if($orderTotal['code'] == 'coupon') { + $data['order_total'][] = $orderTotal; + } + } + } + $data['order_total'] = array( array( 'order_total_id' => '', diff --git a/catalog/controller/extension/module/retailcrm.php b/catalog/controller/extension/module/retailcrm.php index 7b8455d..47777c3 100644 --- a/catalog/controller/extension/module/retailcrm.php +++ b/catalog/controller/extension/module/retailcrm.php @@ -26,6 +26,7 @@ class ControllerExtensionModuleRetailcrm extends Controller $order_id = $parameter3; $data = $this->model_checkout_order->getOrder($order_id); + $data['totals'] = $this->model_account_order->getOrderTotals($order_id); $data['products'] = $this->model_account_order->getOrderProducts($order_id); foreach($data['products'] as $key => $product) { @@ -63,6 +64,7 @@ class ControllerExtensionModuleRetailcrm extends Controller if($data['order_status_id'] == 0) return; $data['products'] = $this->model_account_order->getOrderProducts($order_id); + $data['totals'] = $this->model_account_order->getOrderTotals($order_id); foreach($data['products'] as $key => $product) { $productOptions = $this->model_account_order->getOrderOptions($order_id, $product['order_product_id']); @@ -79,11 +81,6 @@ class ControllerExtensionModuleRetailcrm extends Controller $data['order_status'] = $status['retailcrm_status'][$data['order_status_id']]; } - $data['totals'][] = array( - 'code' => 'shipping', - 'value' => isset($this->session->data['shipping_method']) ? $this->session->data['shipping_method']['cost'] : '' - ); - $this->load->model('extension/retailcrm/order'); $this->model_extension_retailcrm_order->changeInCrm($data, $data['order_id']); } diff --git a/catalog/model/extension/retailcrm/order.php b/catalog/model/extension/retailcrm/order.php index 873d2ff..0ac3a3d 100644 --- a/catalog/model/extension/retailcrm/order.php +++ b/catalog/model/extension/retailcrm/order.php @@ -52,15 +52,19 @@ class ModelExtensionRetailcrmOrder extends Model { $deliveryCost = 0; $altTotals = isset($order_data['order_total']) ? $order_data['order_total'] : ""; $orderTotals = isset($order_data['totals']) ? $order_data['totals'] : $altTotals ; + $couponTotal = 0; if (!empty($orderTotals)) { foreach ($orderTotals as $totals) { if ($totals['code'] == 'shipping') { $deliveryCost = $totals['value']; } + if ($totals['code'] == 'coupon') { + $couponTotal = abs($totals['value']); + } } } - + $order['discount'] = $couponTotal; $order['createdAt'] = $order_data['date_added']; $payment_code = $order_data['payment_code'];