mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-01 19:03:14 +03:00
Fix response status check for abandoned carts
This commit is contained in:
parent
683e00e851
commit
96f62b5e7e
@ -1,3 +1,6 @@
|
|||||||
|
## v3.4.14
|
||||||
|
* Исправлен баг при передаче брошенных корзин.
|
||||||
|
|
||||||
## v3.4.13
|
## v3.4.13
|
||||||
* Добавлена передача информации о модуле в CRM при его установке
|
* Добавлена передача информации о модуле в CRM при его установке
|
||||||
|
|
||||||
|
@ -149,35 +149,33 @@ class RetailcrmCartUploader
|
|||||||
|
|
||||||
$response = static::$api->ordersGet($cartExternalId);
|
$response = static::$api->ordersGet($cartExternalId);
|
||||||
|
|
||||||
if (!($response instanceof RetailcrmApiResponse)) {
|
if ($response instanceof RetailcrmApiResponse) {
|
||||||
// TODO
|
if (empty($response['order'])) {
|
||||||
// Extract address from cart (if exists) and append to customer?
|
// TODO
|
||||||
// Or maybe this customer will not order anything, so we don't need it's address...
|
// Extract address from cart (if exists) and append to customer?
|
||||||
static::$api->customersCreate(RetailcrmOrderBuilder::buildCrmCustomer(new Customer($cart->id_customer)));
|
// Or maybe this customer will not order anything, so we don't need it's address...
|
||||||
|
static::$api->customersCreate(RetailcrmOrderBuilder::buildCrmCustomer(new Customer($cart->id_customer)));
|
||||||
|
|
||||||
$order = static::buildCartOrder($cart, $cartExternalId);
|
$order = static::buildCartOrder($cart, $cartExternalId);
|
||||||
|
|
||||||
if (empty($order)) {
|
if (empty($order)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== static::$api->ordersCreate($order)) {
|
if (false !== static::$api->ordersCreate($order)) {
|
||||||
$cart->date_upd = date('Y-m-d H:i:s');
|
$cart->date_upd = date('Y-m-d H:i:s');
|
||||||
$cart->save();
|
$cart->save();
|
||||||
}
|
}
|
||||||
|
} elseif (!empty($response['order']['externalId'])) {
|
||||||
|
$order = static::buildCartOrder($cart, $response['order']['externalId']);
|
||||||
|
|
||||||
continue;
|
if (empty($order)) {
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($response['order']) && !empty($response['order'])) {
|
if (false !== static::$api->ordersEdit($order)) {
|
||||||
$order = static::buildCartOrder($cart, $response['order']['externalId']);
|
static::registerAbandonedCartSync($cart->id);
|
||||||
|
}
|
||||||
if (empty($order)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false !== static::$api->ordersEdit($order)) {
|
|
||||||
static::registerAbandonedCartSync($cart->id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ require_once dirname(__FILE__) . '/bootstrap.php';
|
|||||||
|
|
||||||
class RetailCRM extends Module
|
class RetailCRM extends Module
|
||||||
{
|
{
|
||||||
const VERSION = '3.4.13';
|
const VERSION = '3.4.14';
|
||||||
|
|
||||||
const API_URL = 'RETAILCRM_ADDRESS';
|
const API_URL = 'RETAILCRM_ADDRESS';
|
||||||
const API_KEY = 'RETAILCRM_API_TOKEN';
|
const API_KEY = 'RETAILCRM_API_TOKEN';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user