1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
productbatchconverter.php
См. документацию.
1<?php
2namespace Bitrix\Catalog\Update;
3
4use Bitrix\Catalog\Config\State;
5use Bitrix\Catalog\Product\Store\BatchBalancer\Balancer;
6use Bitrix\Catalog\StoreProductTable;
7use Bitrix\Main\Loader;
8use Bitrix\Main\Localization\Loc;
9use Bitrix\Main\Update\Stepper;
10
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
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}
static getList(array $parameters=array())
Определения datamanager.php:431
static getCount($filter=array(), array $cache=array())
Определения datamanager.php:516
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$option
Определения options.php:1711