mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-25 22:56:07 +03:00
commit
86064c775f
@ -519,7 +519,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
|
|||||||
|
|
||||||
$this->load->model('extension/retailcrm/order');
|
$this->load->model('extension/retailcrm/order');
|
||||||
$this->model_extension_retailcrm_order->uploadOrder($data, $this->retailcrm->getApiClient());
|
$this->model_extension_retailcrm_order->uploadOrder($data, $this->retailcrm->getApiClient());
|
||||||
$response = $this->model_extension_retailcrm_order->getLastResponse();
|
$response = ModelExtensionRetailcrmOrder::getLastResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$response->isSuccessful()) {
|
if (!$response->isSuccessful()) {
|
||||||
|
@ -5,6 +5,8 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
protected $moduleTitle;
|
protected $moduleTitle;
|
||||||
protected $retailcrmApiClient;
|
protected $retailcrmApiClient;
|
||||||
|
|
||||||
|
protected static $lastRepsonse = null;
|
||||||
|
|
||||||
public function __construct($registry)
|
public function __construct($registry)
|
||||||
{
|
{
|
||||||
parent::__construct($registry);
|
parent::__construct($registry);
|
||||||
@ -81,7 +83,7 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
|
|
||||||
unset($customers);
|
unset($customers);
|
||||||
|
|
||||||
$retailcrmApiClient->ordersCreate($order);
|
self::$lastRepsonse = $retailcrmApiClient->ordersCreate($order);
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
@ -116,6 +118,9 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($delivery_code) && isset($shippingModule)) {
|
if (!isset($delivery_code) && isset($shippingModule)) {
|
||||||
|
if (isset($this->settings[$this->moduleTitle . '_delivery'])
|
||||||
|
&& $this->settings[$this->moduleTitle . '_delivery']
|
||||||
|
) {
|
||||||
$deliveries = array_keys($this->settings[$this->moduleTitle . '_delivery']);
|
$deliveries = array_keys($this->settings[$this->moduleTitle . '_delivery']);
|
||||||
$shipping_code = '';
|
$shipping_code = '';
|
||||||
|
|
||||||
@ -127,6 +132,7 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
|
|
||||||
$delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shipping_code];
|
$delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shipping_code];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($order_data['payment_iso_code_2'])) {
|
if (!empty($order_data['payment_iso_code_2'])) {
|
||||||
$order['countryIso'] = $order_data['payment_iso_code_2'];
|
$order['countryIso'] = $order_data['payment_iso_code_2'];
|
||||||
@ -281,4 +287,12 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function getLastResponse()
|
||||||
|
{
|
||||||
|
return self::$lastRepsonse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,13 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($delivery_code) && isset($shippingModule)) {
|
if (!isset($delivery_code) && isset($shippingModule)) {
|
||||||
|
if (isset($this->settings[$this->moduleTitle . '_delivery'])
|
||||||
|
&& $this->settings[$this->moduleTitle . '_delivery']
|
||||||
|
) {
|
||||||
$deliveries = array_keys($this->settings[$this->moduleTitle . '_delivery']);
|
$deliveries = array_keys($this->settings[$this->moduleTitle . '_delivery']);
|
||||||
$shipping_code = '';
|
$shipping_code = '';
|
||||||
|
|
||||||
array_walk($deliveries, function($item, $key) use ($shippingModule, &$shipping_code) {
|
array_walk($deliveries, function ($item, $key) use ($shippingModule, &$shipping_code) {
|
||||||
if (strripos($item, $shippingModule) !== false) {
|
if (strripos($item, $shippingModule) !== false) {
|
||||||
$shipping_code = $item;
|
$shipping_code = $item;
|
||||||
}
|
}
|
||||||
@ -93,6 +96,7 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
|
|
||||||
$delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shipping_code];
|
$delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shipping_code];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($order_data['payment_iso_code_2'])) {
|
if (!empty($order_data['payment_iso_code_2'])) {
|
||||||
$order['countryIso'] = $order_data['payment_iso_code_2'];
|
$order['countryIso'] = $order_data['payment_iso_code_2'];
|
||||||
|
Loading…
Reference in New Issue
Block a user