1
0
mirror of synced 2025-02-20 08:53:14 +03:00

ref #94710 Fixed an error when transferring abandoned carts (#323)

This commit is contained in:
Uryvskiy Dima 2024-02-29 16:00:48 +03:00 committed by GitHub
parent 53ad81aec3
commit 498646c10a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 19 additions and 8 deletions

View File

@ -1,3 +1,6 @@
## 2024-02-29 4.7.4
* Fixed an error when transferring abandoned carts
## 2024-02-07 4.7.3
* Added filters after creating and updating an order

View File

@ -1 +1 @@
4.7.3
4.7.4

View File

@ -119,7 +119,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
}
if ($this->get_option('abandoned_carts_enabled') === static::YES) {
$this->cart = new WC_Retailcrm_Cart($this->apiClient);
$this->cart = new WC_Retailcrm_Cart($this->apiClient, $this->settings);
add_action('woocommerce_add_to_cart', [$this, 'set_cart']);
add_action('woocommerce_after_cart_item_quantity_update', [$this, 'set_cart']);

View File

@ -17,9 +17,12 @@ if (!class_exists('WC_Retailcrm_Carts')) :
protected $apiClient;
protected $dateFormat;
public function __construct($apiClient)
protected $settings;
public function __construct($apiClient, $settings)
{
$this->apiClient = $apiClient;
$this->settings = $settings;
$this->dateFormat = 'Y-m-d H:i:sP';
}
@ -53,11 +56,13 @@ if (!class_exists('WC_Retailcrm_Carts')) :
return $this->clearCart($customerId, $site, $isCartExist);
}
$useXmlId = isset($this->settings['bind_by_sku']) && $this->settings['bind_by_sku'] === WC_Retailcrm_Base::YES;
foreach ($cartItems as $item) {
$product = $item['data'];
$crmCart['items'][] = [
'offer' => ['externalId' => $product->get_id()],
'offer' => $useXmlId ? ['xmlId' => $product->get_sku()] : ['externalId' => $product->get_id()],
'quantity' => $item['quantity'],
'createdAt' => $product->get_date_created()->date($this->dateFormat) ?? date($this->dateFormat),
'updatedAt' => $product->get_date_modified()->date($this->dateFormat) ?? date($this->dateFormat),

View File

@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
Requires PHP: 7.0
Requires at least: 5.3
Tested up to: 6.4
Stable tag: 4.7.3
Stable tag: 4.7.4
License: GPLv1 or later
License URI: http://www.gnu.org/licenses/gpl-1.0.html
@ -82,6 +82,9 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
== Changelog ==
= 4.7.4 =
* Fixed an error when transferring abandoned carts
= 4.7.3 =
* Added filters after creating and updating an order

View File

@ -5,7 +5,7 @@
* Description: Integration plugin for WooCommerce & Simla.com
* Author: RetailDriver LLC
* Author URI: http://retailcrm.pro/
* Version: 4.7.3
* Version: 4.7.4
* Tested up to: 6.4
* WC requires at least: 5.4
* WC tested up to: 8.5

View File

@ -16,7 +16,7 @@
*
* @link https://wordpress.org/plugins/woo-retailcrm/
*
* @version 4.7.3
* @version 4.7.4
*
* @package RetailCRM
*/

View File

@ -37,7 +37,7 @@ class WC_Retailcrm_Cart_Test extends WC_Retailcrm_Test_Case_Helper
$this->setMockResponse($this->apiMock, 'cartSet', $this->responseMock);
$this->setMockResponse($this->apiMock, 'cartClear', $this->responseMock);
$this->cart = new WC_Retailcrm_Cart($this->apiMock);
$this->cart = new WC_Retailcrm_Cart($this->apiMock, $this->getOptions());
}
public function testApiGetCart()