mirror of
https://github.com/retailcrm/opencart-module.git
synced 2025-04-04 05:43:37 +03:00
Update order.php
Передачу статуса заказа и произвольных полей необходимо вынести за пределы foreach ($orderProducts as $product) {
This commit is contained in:
parent
91f432c539
commit
93ccd80874
1 changed files with 21 additions and 20 deletions
|
@ -265,28 +265,29 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||
if (isset($properties)) $item['properties'] = $properties;
|
||||
|
||||
$order['items'][] = $item;
|
||||
|
||||
if (isset($order_data['order_status_id']) && $order_data['order_status_id'] > 0) {
|
||||
$order['status'] = $this->settings[$this->moduleTitle . '_status'][$order_data['order_status_id']];
|
||||
} elseif (isset($order_data['order_status_id']) && $order_data['order_status_id'] == 0) {
|
||||
$order['status'] = $this->settings[$this->moduleTitle . '_missing_status'];
|
||||
}
|
||||
|
||||
if (isset($this->settings[$this->moduleTitle . '_custom_field']) && $order_data['custom_field']) {
|
||||
$customFields = $order_data['custom_field'];
|
||||
|
||||
foreach ($customFields as $key => $value) {
|
||||
if (isset($this->settings[$this->moduleTitle . '_custom_field']['o_' . $key])) {
|
||||
$customFieldsToCrm[$this->settings[$this->moduleTitle . '_custom_field']['o_' . $key]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($customFieldsToCrm)) {
|
||||
$order['customFields'] = $customFieldsToCrm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($order_data['order_status_id']) && $order_data['order_status_id'] > 0) {
|
||||
$order['status'] = $this->settings[$this->moduleTitle . '_status'][$order_data['order_status_id']];
|
||||
} elseif (isset($order_data['order_status_id']) && $order_data['order_status_id'] == 0) {
|
||||
$order['status'] = $this->settings[$this->moduleTitle . '_missing_status'];
|
||||
}
|
||||
|
||||
if (isset($this->settings[$this->moduleTitle . '_custom_field']) && $order_data['custom_field']) {
|
||||
$customFields = $order_data['custom_field'];
|
||||
|
||||
foreach ($customFields as $key => $value) {
|
||||
if (isset($this->settings[$this->moduleTitle . '_custom_field']['o_' . $key])) {
|
||||
$customFieldsToCrm[$this->settings[$this->moduleTitle . '_custom_field']['o_' . $key]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($customFieldsToCrm)) {
|
||||
$order['customFields'] = $customFieldsToCrm;
|
||||
}
|
||||
}
|
||||
|
||||
$payment = array(
|
||||
'externalId' => $order_id,
|
||||
'type' => $payment_code,
|
||||
|
|
Loading…
Add table
Reference in a new issue