3namespace Bitrix\Catalog\Store\EnableWizard;
5use Bitrix\Catalog\Config\State;
6use Bitrix\Main\Application;
7use Bitrix\Main\Config\Option;
10use Bitrix\Main\UI\Extension;
14 private const MODE_OPTION_NAME =
'store_control_mode';
22 if (in_array(Application::getInstance()->getLicense()->getRegion(), [
'ru',
'by',
'kz'],
true))
32 if (!State::isEnabledInventoryManagement())
37 return self::getMode();
47 $disableResult = self::disableCurrent();
48 if (!$disableResult->isSuccess())
50 return $disableResult;
53 $enableResult = self::getEnabler($mode)->enable(
$options);
54 if ($enableResult->isSuccess())
58 if (Loader::includeModule(
'pull'))
60 \CPullWatch::AddToStack(
61 'CATALOG_INVENTORY_MANAGEMENT_CHANGED',
64 'command' =>
'onCatalogInventoryManagementEnabled',
75 $disableResult = self::disableCurrent();
76 if ($disableResult->isSuccess())
80 if (Loader::includeModule(
'pull'))
82 \CPullWatch::AddToStack(
83 'CATALOG_INVENTORY_MANAGEMENT_CHANGED',
86 'command' =>
'onCatalogInventoryManagementDisabled',
92 return $disableResult;
97 Extension::load([
'catalog.store-enable-wizard']);
103 BX.Catalog.Store.EnableWizardOpener.showEnabledNotificationIfNeeded();
110 private static function disableCurrent():
Result
115 return self::getEnabler($currentMode)->disable();
121 private static function getEnabler(
string $mode): Enabler
130 private static function setMode(
string $mode): void
137 Option::set(
'catalog', self::MODE_OPTION_NAME, $mode);
140 private static function resetMode(): void
142 Option::set(
'catalog', self::MODE_OPTION_NAME);
145 private static function getMode(): string
147 $mode = Option::get(
'catalog', self::MODE_OPTION_NAME);
static enable(string $mode, array $options=[])
static showEnabledJsNotificationIfNeeded()
static getAvailableModes()
static isValidMode(string $mode)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)