1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
productbatchconverter.php
См. документацию.
1
<?php
2
namespace
Bitrix\Catalog\Update;
3
4
use Bitrix\Catalog\Config\State;
5
use Bitrix\Catalog\Product\Store\BatchBalancer\Balancer;
6
use Bitrix\Catalog\StoreProductTable;
7
use Bitrix\Main\Loader;
8
use Bitrix\Main\Localization\Loc;
9
use Bitrix\Main\Update\Stepper;
10
18
class
ProductBatchConverter
extends
Stepper
19
{
20
protected
const
PRODUCT_LIMIT
= 100;
21
22
protected
static
$moduleId
=
'catalog'
;
23
24
public
function
execute
(
array
&
$option
): bool
25
{
26
if
(!Loader::includeModule(
'catalog'
) || !State::isUsedInventoryManagement())
27
{
28
return
self::FINISH_EXECUTION;
29
}
30
31
$option
[
"count"
] =
StoreProductTable::getCount
();
32
$option
[
"steps"
] ??= 0;
33
$option
[
"lastProductId"
] ??= 0;
34
$storeProductDataRaw =
StoreProductTable::getList
([
35
'limit'
=> self::PRODUCT_LIMIT,
36
'select'
=> [
'PRODUCT_ID'
],
37
'filter'
=> [
38
'>PRODUCT_ID'
=> (
int
)
$option
[
"lastProductId"
],
39
],
40
'group'
=> [
'PRODUCT_ID'
],
41
'order'
=> [
'PRODUCT_ID'
=>
'ASC'
],
42
]);
43
44
$batchCount = 0;
45
while
($storeProduct = $storeProductDataRaw->fetch())
46
{
47
$storeProductId = $storeProduct[
'PRODUCT_ID'
];
48
$option
[
"lastProductId"
] = $storeProductId;
49
50
(
new
Balancer
($storeProductId))->fill();
51
52
$batchCount++;
53
}
54
55
$option
[
"steps"
] += $batchCount;
56
57
return
$batchCount === 0 ? self::FINISH_EXECUTION : self::CONTINUE_EXECUTION;
58
}
59
60
public
static
function
getTitle
()
61
{
62
return
Loc::getMessage(
'CATALOG_PRODUCT_BATCH_CONVERTER_TITLE'
);
63
}
64
}
Bitrix\Catalog\Product\Store\BatchBalancer\Balancer
Определения
balancer.php:14
Bitrix\Catalog\Update\ProductBatchConverter
Определения
productbatchconverter.php:19
Bitrix\Catalog\Update\ProductBatchConverter\execute
execute(array &$option)
Определения
productbatchconverter.php:24
Bitrix\Catalog\Update\ProductBatchConverter\$moduleId
static $moduleId
Определения
productbatchconverter.php:22
Bitrix\Catalog\Update\ProductBatchConverter\getTitle
static getTitle()
Определения
productbatchconverter.php:60
Bitrix\Catalog\Update\ProductBatchConverter\PRODUCT_LIMIT
const PRODUCT_LIMIT
Определения
productbatchconverter.php:20
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Main\ORM\Data\DataManager\getCount
static getCount($filter=array(), array $cache=array())
Определения
datamanager.php:516
Bitrix\Main\Update\Stepper
Определения
stepper.php:29
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$option
$option
Определения
options.php:1711
bitrix
modules
catalog
lib
update
productbatchconverter.php
Создано системой
1.14.0