mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-29 00:26:06 +03:00
fix paths, fix data format, change code injection path, update docs
This commit is contained in:
parent
9deaca8a3e
commit
14795c351e
@ -46,11 +46,9 @@ $this->load->model('intarocrm/order');
|
|||||||
$this->model_intarocrm_order->send($data, $order_id);
|
$this->model_intarocrm_order->send($data, $order_id);
|
||||||
```
|
```
|
||||||
|
|
||||||
Add this lines into /catalog/model/checkout/order.php script, into addOrder method before return statement and
|
Add this lines into:
|
||||||
into /admin/model/sale/order.php script, into addOrder & editOrder methods at the end of these methods
|
* /catalog/controller/checkout/confirm.php script, into index method before setOutput call
|
||||||
|
* /admin/model/sale/order.php script, into addOrder & editOrder methods at the end of these methods
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Export new order from CRM to shop
|
#### Export new order from CRM to shop
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class ApiHelper
|
|||||||
$customer['firstName'] = $data['firstname'];
|
$customer['firstName'] = $data['firstname'];
|
||||||
$customer['lastName'] = $data['lastname'];
|
$customer['lastName'] = $data['lastname'];
|
||||||
$customer['email'] = $data['email'];
|
$customer['email'] = $data['email'];
|
||||||
$customer['phones']['number'] = $data['telephone'];
|
$customer['phones'] = array(array('number' => $data['telephone']));
|
||||||
|
|
||||||
$customer['address']['text'] = implode(', ', array(
|
$customer['address']['text'] = implode(', ', array(
|
||||||
$data['payment_postcode'],
|
$data['payment_postcode'],
|
||||||
@ -63,15 +63,18 @@ class ApiHelper
|
|||||||
));
|
));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->intaroApi->customerEdit($customer);
|
$this->customer = $this->intaroApi->customerEdit($customer);
|
||||||
} catch (IntaroCrm\Exception\ApiException $e) {
|
} catch (IntaroCrm\Exception\ApiException $e) {
|
||||||
|
$this->customer = $e->getMessage();
|
||||||
$this->log->addError('['.$this->domain.'] RestApi::orderCreate:' . $e->getMessage());
|
$this->log->addError('['.$this->domain.'] RestApi::orderCreate:' . $e->getMessage());
|
||||||
$this->log->addError('['.$this->domain.'] RestApi::orderCreate:' . json_encode($order));
|
$this->log->addError('['.$this->domain.'] RestApi::orderCreate:' . json_encode($order));
|
||||||
} catch (IntaroCrm\Exception\CurlException $e) {
|
} catch (IntaroCrm\Exception\CurlException $e) {
|
||||||
|
$this->customer = $e->getMessage();
|
||||||
$this->log->addError('['.$this->domain.'] RestApi::orderCreate::Curl:' . $e->getMessage());
|
$this->log->addError('['.$this->domain.'] RestApi::orderCreate::Curl:' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($customer);
|
||||||
unset($customers);
|
unset($customers);
|
||||||
|
|
||||||
$order['externalId'] = $data['order_id'];
|
$order['externalId'] = $data['order_id'];
|
||||||
@ -81,27 +84,26 @@ class ApiHelper
|
|||||||
$order['phone'] = $data['telephone'];
|
$order['phone'] = $data['telephone'];
|
||||||
$order['customerComment'] = $data['comment'];
|
$order['customerComment'] = $data['comment'];
|
||||||
|
|
||||||
$order['deliveryCost'] = 0;
|
$deliveryCost = 0;
|
||||||
foreach ($data['totals'] as $totals) {
|
foreach ($data['totals'] as $totals) {
|
||||||
if ($totals['code'] == 'shipping') {
|
if ($totals['code'] == 'shipping') {
|
||||||
$order['deliveryCost'] = $totals['value'];
|
$deliveryCost = $totals['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$order['deliveryAddress']['text'] = implode(', ', array(
|
|
||||||
$data['shipping_postcode'],
|
|
||||||
$data['shipping_country'],
|
|
||||||
$data['shipping_city'],
|
|
||||||
$data['shipping_address_1'],
|
|
||||||
$data['shipping_address_2']
|
|
||||||
));
|
|
||||||
|
|
||||||
$order['createdAt'] = date('Y-m-d H:i:s');
|
$order['createdAt'] = date('Y-m-d H:i:s');
|
||||||
$order['paymentType'] = $settings['intarocrm_payment'][$payment_code];
|
$order['paymentType'] = $settings['intarocrm_payment'][$payment_code];
|
||||||
|
|
||||||
$order['delivery'] = array(
|
$order['delivery'] = array(
|
||||||
'code' => $settings['intarocrm_delivery'][$delivery_code],
|
'code' => $settings['intarocrm_delivery'][$delivery_code],
|
||||||
'cost' => $order['deliveryCost']
|
'cost' => $deliveryCost,
|
||||||
|
'address' => array('text' => implode(', ', array(
|
||||||
|
$data['shipping_postcode'],
|
||||||
|
$data['shipping_country'],
|
||||||
|
$data['shipping_city'],
|
||||||
|
$data['shipping_address_1'],
|
||||||
|
$data['shipping_address_2']
|
||||||
|
)))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3",
|
"php": ">=5.3",
|
||||||
"intarocrm/rest-api-client": "1.2.*",
|
"intarocrm/rest-api-client": "1.3.*",
|
||||||
"symfony/console": "dev-master",
|
"symfony/console": "dev-master",
|
||||||
"monolog/monolog": "dev-master"
|
"monolog/monolog": "dev-master"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user