fix delivery & hook data

This commit is contained in:
Alex Lushpai 2016-03-11 14:15:24 +03:00
parent c4230bbadd
commit 8835251d80
4 changed files with 15 additions and 11 deletions

View File

@ -205,7 +205,6 @@ class ControllerModuleRetailcrm extends Controller
'token=' . $this->session->data['token'], 'SSL'
);
$_data['modules'] = array();
if (isset($this->request->post['retailcrm_module'])) {
@ -290,7 +289,7 @@ class ControllerModuleRetailcrm extends Controller
$data['order_status'] = $status['retailcrm_status'][$data['order_status_id']];
$this->load->model('retailcrm/order');
$this->model_retailcrm_order->sendToCrm($data, $order['order_id']);
$this->model_retailcrm_order->sendToCrm($data, $data['order_id']);
}
}

View File

@ -86,7 +86,7 @@ class ModelRetailcrmOrder extends Model {
);
}
if (isset($order_data['order_status_id'])) {
if (isset($order_data['order_status_id']) && $order_data['order_status_id'] > 0) {
$order['status'] = $settings['retailcrm_status'][$order_data['order_status_id']];
}
@ -163,7 +163,7 @@ class ModelRetailcrmOrder extends Model {
);
}
if (isset($order_data['order_status_id'])) {
if (isset($order_data['order_status_id']) && $order_data['order_status_id'] > 0) {
$order['status'] = $settings['retailcrm_status'][$order_data['order_status_id']];
}

View File

@ -29,10 +29,12 @@ class ControllerModuleRetailcrm extends Controller
if (!isset($data['fromApi'])) {
$this->load->model('setting/setting');
$status = $this->model_setting_setting->getSetting('retailcrm');
$data['order_status'] = $status['retailcrm_status'][$data['order_status_id']];
if ($data['order_status_id'] > 0) {
$data['order_status'] = $status['retailcrm_status'][$data['order_status_id']];
}
$this->load->model('retailcrm/order');
$this->model_retailcrm_order->sendToCrm($data, $order['order_id']);
$this->model_retailcrm_order->sendToCrm($data, $data['order_id']);
}
}
}

View File

@ -44,11 +44,14 @@ class ModelRetailcrmOrder extends Model {
$order['customerComment'] = $order_data['comment'];
$deliveryCost = 0;
$orderTotals = isset($order_data['totals']) ? $order_data['totals'] : $order_data['order_total'] ;
$altTotals = isset($order_data['order_total']) ? $order_data['order_total'] : "";
$orderTotals = isset($order_data['totals']) ? $order_data['totals'] : $altTotals ;
foreach ($orderTotals as $totals) {
if ($totals['code'] == 'shipping') {
$deliveryCost = $totals['value'];
if (!empty($orderTotals)) {
foreach ($orderTotals as $totals) {
if ($totals['code'] == 'shipping') {
$deliveryCost = $totals['value'];
}
}
}
@ -86,7 +89,7 @@ class ModelRetailcrmOrder extends Model {
);
}
if (isset($order_data['order_status_id'])) {
if (isset($order_data['order_status_id']) && $order_data['order_status_id'] > 0) {
$order['status'] = $settings['retailcrm_status'][$order_data['order_status_id']];
}