mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-25 14:46:06 +03:00
v3.1.1
This commit is contained in:
parent
86064c775f
commit
57c2ca99c9
@ -1,3 +1,6 @@
|
|||||||
|
## v.3.1.1
|
||||||
|
* Добавлено создание клиента при ручной выгрузке заказа из админки
|
||||||
|
|
||||||
## v.3.1.0
|
## v.3.1.0
|
||||||
* Переработан дизайн шаблона twig
|
* Переработан дизайн шаблона twig
|
||||||
* Добавлена настройка передачи номера заказа в retailCRM
|
* Добавлена настройка передачи номера заказа в retailCRM
|
||||||
|
@ -65,6 +65,27 @@ class ModelExtensionRetailcrmCustomer extends Model {
|
|||||||
return $customerToCrm;
|
return $customerToCrm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create customer
|
||||||
|
*
|
||||||
|
* @param array $customer
|
||||||
|
* @param \RetailcrmProxy $retailcrmApiClient
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function sendToCrm($customer, $retailcrmApiClient)
|
||||||
|
{
|
||||||
|
if ($retailcrmApiClient === false || empty($customer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$customerToCrm = $this->process($customer);
|
||||||
|
|
||||||
|
$retailcrmApiClient->customersCreate($customerToCrm);
|
||||||
|
|
||||||
|
return $customerToCrm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process customer
|
* Process customer
|
||||||
*
|
*
|
||||||
|
@ -64,6 +64,14 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$order = $this->process($order_data);
|
||||||
|
|
||||||
|
if (isset($order['customer']['externalId'])) {
|
||||||
|
$this->load->model('extension/retailcrm/customer');
|
||||||
|
$this->load->model('customer/customer');
|
||||||
|
$customer = $this->model_customer_customer->getCustomer($order['customer']['externalId']);
|
||||||
|
$this->model_extension_retailcrm_customer->sendToCrm($customer, $retailcrmApiClient);
|
||||||
|
} else {
|
||||||
$customers = $retailcrmApiClient->customersList(
|
$customers = $retailcrmApiClient->customersList(
|
||||||
array(
|
array(
|
||||||
'name' => $order_data['telephone'],
|
'name' => $order_data['telephone'],
|
||||||
@ -73,8 +81,6 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
100
|
100
|
||||||
);
|
);
|
||||||
|
|
||||||
$order = $this->process($order_data);
|
|
||||||
|
|
||||||
if ($customers) {
|
if ($customers) {
|
||||||
foreach ($customers['customers'] as $customer) {
|
foreach ($customers['customers'] as $customer) {
|
||||||
$order['customer']['id'] = $customer['id'];
|
$order['customer']['id'] = $customer['id'];
|
||||||
@ -82,6 +88,7 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unset($customers);
|
unset($customers);
|
||||||
|
}
|
||||||
|
|
||||||
self::$lastRepsonse = $retailcrmApiClient->ordersCreate($order);
|
self::$lastRepsonse = $retailcrmApiClient->ordersCreate($order);
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ class ModelRetailcrmOrderAdminTest extends OpenCartTest
|
|||||||
'ordersUpload',
|
'ordersUpload',
|
||||||
'customersList',
|
'customersList',
|
||||||
'ordersCreate',
|
'ordersCreate',
|
||||||
'ordersPaymentCreate'
|
'ordersPaymentCreate',
|
||||||
|
'customersCreate'
|
||||||
))
|
))
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user