The method for determining the stock quantity has been optimized (#354)
This commit is contained in:
parent
6e39fca72c
commit
cdc7ca71bc
@ -1,3 +1,6 @@
|
|||||||
|
## 2024-11-07 4.8.14
|
||||||
|
* The method for determining the stock quantity has been optimized
|
||||||
|
|
||||||
## 2024-11-07 4.8.13
|
## 2024-11-07 4.8.13
|
||||||
* Supports custom cart and checkout templates
|
* Supports custom cart and checkout templates
|
||||||
|
|
||||||
|
@ -253,13 +253,6 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
|||||||
$tax = reset($tax_rates);
|
$tax = reset($tax_rates);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($product->get_manage_stock() == true) {
|
|
||||||
$stockQuantity = $product->get_stock_quantity();
|
|
||||||
$quantity = empty($stockQuantity) === false ? $stockQuantity : 0;
|
|
||||||
} else {
|
|
||||||
$quantity = $product->get_stock_status() === 'instock' ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$productData = [
|
$productData = [
|
||||||
'id' => $product->get_id(),
|
'id' => $product->get_id(),
|
||||||
'productId' => ($product->get_parent_id() > 0) ? $parent->get_id() : $product->get_id(),
|
'productId' => ($product->get_parent_id() > 0) ? $parent->get_id() : $product->get_id(),
|
||||||
@ -271,7 +264,7 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
|||||||
,
|
,
|
||||||
'picture' => $images,
|
'picture' => $images,
|
||||||
'url' => ($product->get_parent_id() > 0) ? $parent->get_permalink() : $product->get_permalink(),
|
'url' => ($product->get_parent_id() > 0) ? $parent->get_permalink() : $product->get_permalink(),
|
||||||
'quantity' => $quantity,
|
'quantity' => $this->getQuantity($product),
|
||||||
'categoryId' => $termList,
|
'categoryId' => $termList,
|
||||||
'dimensions' => $dimensions,
|
'dimensions' => $dimensions,
|
||||||
'weight' => $weight,
|
'weight' => $weight,
|
||||||
@ -309,9 +302,19 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
|||||||
$product
|
$product
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($productData)) {
|
return $productData ?? [];
|
||||||
return $productData;
|
}
|
||||||
|
|
||||||
|
private function getQuantity($product)
|
||||||
|
{
|
||||||
|
if ($product->get_manage_stock()) {
|
||||||
|
$stockQuantity = $product->get_stock_quantity();
|
||||||
|
$quantity = $stockQuantity !== null && $stockQuantity !== 0 ? $stockQuantity : 0;
|
||||||
|
} else {
|
||||||
|
$quantity = $product->get_stock_status() === 'instock' ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
|||||||
Requires PHP: 7.1
|
Requires PHP: 7.1
|
||||||
Requires at least: 5.3
|
Requires at least: 5.3
|
||||||
Tested up to: 6.5
|
Tested up to: 6.5
|
||||||
Stable tag: 4.8.13
|
Stable tag: 4.8.14
|
||||||
License: GPLv1 or later
|
License: GPLv1 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
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 ==
|
== Changelog ==
|
||||||
|
= 4.8.14 =
|
||||||
|
* The method for determining the stock quantity has been optimized
|
||||||
|
|
||||||
= 4.8.13 =
|
= 4.8.13 =
|
||||||
* Supports custom cart and checkout templates
|
* Supports custom cart and checkout templates
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Description: Integration plugin for WooCommerce & Simla.com
|
* Description: Integration plugin for WooCommerce & Simla.com
|
||||||
* Author: RetailDriver LLC
|
* Author: RetailDriver LLC
|
||||||
* Author URI: http://retailcrm.pro/
|
* Author URI: http://retailcrm.pro/
|
||||||
* Version: 4.8.13
|
* Version: 4.8.14
|
||||||
* Tested up to: 6.5
|
* Tested up to: 6.5
|
||||||
* Requires Plugins: woocommerce
|
* Requires Plugins: woocommerce
|
||||||
* WC requires at least: 5.4
|
* WC requires at least: 5.4
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||||
*
|
*
|
||||||
* @version 4.8.13
|
* @version 4.8.14
|
||||||
*
|
*
|
||||||
* @package RetailCRM
|
* @package RetailCRM
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user