1
0
mirror of synced 2025-03-22 16:13:50 +03:00

Add display of the total number of product variables

This commit is contained in:
Dima Uryvskiy 2021-03-15 18:18:55 +03:00 committed by GitHub
parent 3ba2f1662e
commit 84d36f7c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 5 deletions

View File

@ -1,3 +1,11 @@
## 2021-03-15 4.2.4
* Добавили отображение общего количества вариативных товаров
* Добавили валидацию на дату создания заказа
* Добавили валидацию на заказы с auto-draft статусом
* Обновили версии WP и WC в локальных тестах
* Исправили баг в опции "Передача номера заказа"
## 2021-01-20 4.2.3
* Обновление версии в маркетплейсе

View File

@ -1 +1 @@
4.2.3
4.2.4

View File

@ -53,6 +53,7 @@ if (!class_exists('WC_Retailcrm_Inventories')) :
}
$page = 1;
$variationProducts = array();
do {
/** @var WC_Retailcrm_Response $result */
@ -70,8 +71,14 @@ if (!class_exists('WC_Retailcrm_Inventories')) :
$product = retailcrm_get_wc_product($offer[$this->bind_field], $this->retailcrm_settings);
if ($product instanceof WC_Product) {
if ($product->get_type() == 'variable') {
continue;
if ($product->get_type() == 'variation' || $product->get_type() == 'variable') {
$parentId = $product->get_parent_id();
if (isset($variationProducts[$parentId])) {
$variationProducts[$parentId] += $offer['quantity'];
} else {
$variationProducts[$parentId] = $offer['quantity'];
}
}
$product->set_manage_stock(true);
@ -80,6 +87,13 @@ if (!class_exists('WC_Retailcrm_Inventories')) :
}
}
}
foreach ($variationProducts as $id => $quantity) {
$variationProduct = wc_get_product($id);
$variationProduct->set_manage_stock(true);
$variationProduct->set_stock($quantity);
$success[] = $variationProduct->save();
}
} while ($page <= $totalPageCount);
return $success;

View File

@ -83,6 +83,13 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
== Changelog ==
= 4.2.4 =
* Добавили отображение общего количества вариативных товаров
* Добавили валидацию на дату создания заказа
* Добавили валидацию на заказы с auto-draft статусом
* Обновили версии WP и WC в локальных тестах
* Исправили баг в опции "Передача номера заказа"
= 4.2.3=
* Обновление версии в маркетплейсе

View File

@ -1,6 +1,6 @@
<?php
/**
* Version: 4.2.3
* Version: 4.2.4
* WC requires at least: 3.0
* WC tested up to: 4.7.1
* Plugin Name: WooCommerce RetailCRM

View File

@ -15,7 +15,7 @@
*
*
* @link https://wordpress.org/plugins/woo-retailcrm/
* @version 4.2.3
* @version 4.2.4
*
* @package RetailCRM
*/