opencart-module/vqmod/xml/retailcrm_create_order.xml

48 lines
2.0 KiB
XML
Raw Normal View History

2016-01-29 18:04:48 +03:00
<?xml version="1.0" encoding="UTF-8"?>
<modification>
2016-02-09 16:32:33 +03:00
<id>Send order to RetailCRM when it created</id>
<version>1.5.x</version>
<vqmver required="true">2.3.x</vqmver>
<author>retailcrm.ru</author>
2016-01-29 18:04:48 +03:00
2016-03-14 18:35:06 +03:00
<file path="catalog/controller/checkout/" name="success.php">
2016-02-09 16:32:33 +03:00
<operation error="skip">
2016-03-14 18:35:06 +03:00
<search position="before" ><![CDATA[$this->cart->clear()]]></search>
2016-02-09 16:32:33 +03:00
<add><![CDATA[
2016-03-14 18:35:06 +03:00
$this->load->model('account/order');
$this->load->model('checkout/order');
2016-02-09 16:32:33 +03:00
$this->load->model('retailcrm/order');
2016-03-14 18:35:06 +03:00
$order = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$order['products'] = $this->model_account_order->getOrderProducts($this->session->data['order_id']);
2016-03-16 15:28:07 +03:00
$order['order_total'] = $this->model_account_order->getOrderTotals($this->session->data['order_id']);
2016-03-14 18:35:06 +03:00
$this->model_retailcrm_order->sendToCrm($order, $this->session->data['order_id']);
2016-02-09 16:32:33 +03:00
]]></add>
</operation>
</file>
2016-01-29 18:04:48 +03:00
2016-03-14 18:35:06 +03:00
<file path="admin/model/sale/" name="order.php">
<operation error="skip">
<search position="after" ><![CDATA[$this->db->query("UPDATE `" . DB_PREFIX . "order` SET total = '" . (float)$total . "', affiliate_id = '" . (int)$affiliate_id . "', commission = '" . (float)$commission . "' WHERE order_id = '" . (int)$order_id . "'");]]></search>
<add><![CDATA[
2016-02-09 16:32:33 +03:00
if (!isset($data['fromApi'])) {
2016-01-29 18:04:48 +03:00
$this->load->model('setting/setting');
$status = $this->model_setting_setting->getSetting('retailcrm');
if (!empty($data['order_status_id'])) {
$data['order_status'] = $status['retailcrm_status'][$data['order_status_id']];
}
$this->load->model('retailcrm/order');
if (isset ($order_query)) {
$this->model_retailcrm_order->changeInCrm($data, $order_id);
} else {
$this->model_retailcrm_order->sendToCrm($data, $order_id);
}
}
2016-02-09 16:32:33 +03:00
]]></add>
2016-03-14 18:35:06 +03:00
</operation>
</file>
2016-01-29 18:04:48 +03:00
</modification>