Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/components/bitrix/catalog.store.enablewizard/ |
Upload File : |
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } use Bitrix\Catalog\Config\Feature; use Bitrix\Main\Localization\Loc; use Bitrix\Catalog\Product\Store\CostPriceCalculator; use Bitrix\Main\Application; use Bitrix\Catalog\Store\EnableWizard\ModeList; use Bitrix\Catalog\Store\EnableWizard\Manager; use Bitrix\Main\Loader; use Bitrix\Catalog\Store\EnableWizard\OnecVersionList; use Bitrix\Catalog\Store\EnableWizard\ConditionsChecker; use Bitrix\Catalog\Url\InventoryManagementSourceBuilder; use Bitrix\Main\Engine\Contract\Controllerable; use Bitrix\Catalog\Store\EnableWizard\OnecAppManager; use Bitrix\Catalog\Store\EnableWizard\TariffChecker; Loc::loadLanguageFile(__FILE__); Loader::includeModule('catalog'); class CatalogStoreEnableWizardComponent extends CBitrixComponent implements Controllerable { public function executeComponent() { $request = Application::getInstance()->getContext()->getRequest(); $currentMode = Manager::getCurrentMode(); $this->arResult = [ 'options' => [ 'currentMode' => Manager::getCurrentMode(), 'initEnableMode' => $request->get('initEnableMode'), 'availableModes' => self::getModesOptions(), 'hasConductedDocumentsOrQuantities' => ConditionsChecker::hasConductedDocumentsOrQuantities(), 'areTherePublishedShops' => ConditionsChecker::areTherePublishedShops(), 'areThereActiveProducts' => ConditionsChecker::areThereActiveProducts(), 'inventoryManagementSource' => InventoryManagementSourceBuilder::getInstance() ->getInventoryManagementSource(), ], 'analytics' => [ 'tool' => 'inventory', 'category' => 'enable_wizard', 'type' => count(self::getModesOptions()) > 1 ? 'slider_1ะก' : 'slider_B24', 'c_section' => $request->get('analyticsContextSection'), 'p1' => 'mode_' . ($currentMode ?? 'None'), ], ]; $this->includeComponentTemplate(); } private static function getModesOptions(): array { $result = []; $allModesOptions = [ ModeList::B24 => [ 'costPriceMethodList' => CostPriceCalculator::getMethodList(), 'isPlanRestricted' => !Feature::isInventoryManagementEnabled(), ], ModeList::ONEC => [ 'versionList' => OnecVersionList::getList(), 'installUrl' => OnecAppManager::getInstallUrl(), 'isPlanRestricted' => TariffChecker::isOnecInventoryManagementRestricted(), ], ]; $availableModes = Manager::getAvailableModes(); foreach ($availableModes as $availableMode) { if (!isset($allModesOptions[$availableMode])) { continue; } $result[$availableMode] = $allModesOptions[$availableMode]; } return $result; } public function getOnecAppAction(): array { return [ 'isInstalled' => OnecAppManager::isAppInstalled(), ]; } public function configureActions() { return []; } }