mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-25 06:36: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);
|
||||
```
|
||||
|
||||
Add this lines into /catalog/model/checkout/order.php script, into addOrder method before return statement and
|
||||
into /admin/model/sale/order.php script, into addOrder & editOrder methods at the end of these methods
|
||||
|
||||
|
||||
|
||||
Add this lines into:
|
||||
* /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
|
||||
|
||||
|
@ -52,7 +52,7 @@ class ApiHelper
|
||||
$customer['firstName'] = $data['firstname'];
|
||||
$customer['lastName'] = $data['lastname'];
|
||||
$customer['email'] = $data['email'];
|
||||
$customer['phones']['number'] = $data['telephone'];
|
||||
$customer['phones'] = array(array('number' => $data['telephone']));
|
||||
|
||||
$customer['address']['text'] = implode(', ', array(
|
||||
$data['payment_postcode'],
|
||||
@ -63,15 +63,18 @@ class ApiHelper
|
||||
));
|
||||
|
||||
try {
|
||||
$this->intaroApi->customerEdit($customer);
|
||||
$this->customer = $this->intaroApi->customerEdit($customer);
|
||||
} 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:' . json_encode($order));
|
||||
} catch (IntaroCrm\Exception\CurlException $e) {
|
||||
$this->customer = $e->getMessage();
|
||||
$this->log->addError('['.$this->domain.'] RestApi::orderCreate::Curl:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
unset($customer);
|
||||
unset($customers);
|
||||
|
||||
$order['externalId'] = $data['order_id'];
|
||||
@ -81,27 +84,26 @@ class ApiHelper
|
||||
$order['phone'] = $data['telephone'];
|
||||
$order['customerComment'] = $data['comment'];
|
||||
|
||||
$order['deliveryCost'] = 0;
|
||||
$deliveryCost = 0;
|
||||
foreach ($data['totals'] as $totals) {
|
||||
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['paymentType'] = $settings['intarocrm_payment'][$payment_code];
|
||||
|
||||
$order['delivery'] = array(
|
||||
'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": {
|
||||
"php": ">=5.3",
|
||||
"intarocrm/rest-api-client": "1.2.*",
|
||||
"intarocrm/rest-api-client": "1.3.*",
|
||||
"symfony/console": "dev-master",
|
||||
"monolog/monolog": "dev-master"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user