mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
update logs derictory: README.md
update logs derictory: README.ru.md add coupon processing: admin/model/extension/retailcrm/history.php add coupon processing: catalog/controller/extension/module/retailcrm.php add coupon processing: catalog/model/extension/retailcrm/order.php
This commit is contained in:
parent
f92d6aaf54
commit
a84925fd19
@ -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
|
||||
|
@ -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 установите путь к файлу выгрузки
|
||||
|
@ -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' => '',
|
||||
|
@ -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']);
|
||||
}
|
||||
|
@ -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'];
|
||||
|
Loading…
Reference in New Issue
Block a user