17 private const PRODUCT_SETS =
'catalog_product_sets';
18 private const MULTI_PRICE_TYPES =
'catalog_multi_price_types';
19 private const CUMULATIVE_DISCOUNTS =
'catalog_cumulative_discounts';
20 private const MULTI_WARENHOUSES =
'catalog_multi_warenhouses';
21 private const EXTENDED_PRICES =
'catalog_price_quantity_ranges';
22 private const INVENTORY_MANAGEMENT =
'catalog_inventory_management';
23 private const COMMON_PRODUCT_PROCESSING =
'catalog_common_product_processing';
24 private const PRODUCT_LIMIT =
'catalog_product_limit';
25 private const CATALOG_PERMISSIONS =
'catalog_permissions';
26 private const CATALOG_SERVICES =
'catalog_services';
28 private const LANDING_PRODUCT_LIMIT_VARIABLE =
'landing_product_limit';
31 private static ?
bool $bitrix24Included =
null;
34 private static array $tranferList = [
35 self::PRODUCT_SETS =>
'CatCompleteSet',
36 self::MULTI_PRICE_TYPES =>
'CatMultiPrice',
37 self::CUMULATIVE_DISCOUNTS =>
'CatDiscountSave',
38 self::MULTI_WARENHOUSES =>
'CatMultiStore'
42 private static array $retailExist = [
43 self::PRODUCT_SETS =>
true,
44 self::MULTI_PRICE_TYPES =>
true,
45 self::CUMULATIVE_DISCOUNTS =>
true,
46 self::MULTI_WARENHOUSES => true
50 private static array $bitrix24exist = [
51 self::PRODUCT_SETS =>
true,
52 self::EXTENDED_PRICES =>
true,
53 self::MULTI_PRICE_TYPES =>
true,
54 self::MULTI_WARENHOUSES =>
true,
55 self::INVENTORY_MANAGEMENT =>
true,
56 self::COMMON_PRODUCT_PROCESSING =>
true,
57 self::CATALOG_PERMISSIONS =>
true,
58 self::CATALOG_SERVICES =>
true,
62 private static array $bitrix24helpCodes = [
63 self::PRODUCT_SETS =>
'limit_shop_bundles',
64 self::MULTI_PRICE_TYPES =>
'limit_shop_variable_prices',
65 self::EXTENDED_PRICES =>
'limit_shop_variable_prices',
66 self::MULTI_WARENHOUSES =>
'limit_shop_stocks',
67 self::INVENTORY_MANAGEMENT =>
'limit_store_inventory_management',
68 self::PRODUCT_LIMIT =>
'limit_shop_products',
69 self::CATALOG_PERMISSIONS =>
'limit_crm_catalog_access_permissions',
70 self::CATALOG_SERVICES =>
'limit_crm_catalog_services',
73 private static int $helpCodesCounter = 0;
74 private static bool $initUi =
false;
82 if (self::isBitrix24())
84 $result = (int)Bitrix24\Feature::getVariable(self::LANDING_PRODUCT_LIMIT_VARIABLE);
97 return self::isFeatureEnabled(self::PRODUCT_SETS);
107 return self::isFeatureEnabled(self::EXTENDED_PRICES);
117 return self::isFeatureEnabled(self::MULTI_PRICE_TYPES);
127 return self::isFeatureEnabled(self::CUMULATIVE_DISCOUNTS);
137 return self::isFeatureEnabled(self::MULTI_WARENHOUSES);
147 return self::isFeatureEnabled(self::INVENTORY_MANAGEMENT);
157 if (!self::isBitrix24())
159 return Option::get(
'catalog',
'catalog_common_product_processing') ===
'Y';
162 return self::isFeatureEnabled(self::COMMON_PRODUCT_PROCESSING);
172 return self::isFeatureEnabled(self::CATALOG_PERMISSIONS);
184 if (self::isBitrix24())
186 $lang = \CBitrix24::getLicensePrefix();
188 elseif (Loader::includeModule(
'intranet'))
190 $lang = \CIntranetUtils::getPortalZone();
192 elseif (Option::get(
'main',
'vendor') ===
'1c_bitrix')
197 return in_array($lang, [
'ru',
'by',
'kz'],
true);
207 return self::isFeatureEnabled(self::CATALOG_SERVICES);
222 return self::LANDING_PRODUCT_LIMIT_VARIABLE;
232 return self::getHelpLink(self::PRODUCT_SETS);
242 return self::getHelpLink(self::EXTENDED_PRICES);
252 return self::getHelpLink(self::MULTI_PRICE_TYPES);
262 return self::getHelpLink(self::MULTI_WARENHOUSES);
272 return self::getHelpLink(self::INVENTORY_MANAGEMENT);
282 return self::getHelpLink(self::PRODUCT_LIMIT);
292 return self::getHelpLink(self::CATALOG_PERMISSIONS);
302 return self::getHelpLink(self::CATALOG_SERVICES);
312 if (!self::isBitrix24())
316 if (self::$helpCodesCounter <= 0 || self::$initUi)
320 if (Loader::includeModule(
'ui'))
322 self::$initUi =
true;
323 Main\UI\Extension::load(
'ui.info-helper');
333 private static function isFeatureEnabled(
string $featureId): bool
335 if ($featureId ===
'')
341 if (self::isBitrix24())
343 if (isset(self::$bitrix24exist[$featureId]))
345 $result = Bitrix24\Feature::isFeatureEnabled($featureId);
350 if (isset(self::$retailExist[$featureId]))
352 $result = \CBXFeatures::IsFeatureEnabled(self::$tranferList[$featureId]);
365 private static function getHelpLink(
string $featureId): ?array
367 if (!self::isBitrix24())
371 if (!isset(self::$bitrix24helpCodes[$featureId]))
375 self::$helpCodesCounter++;
378 'LINK' =>
'top.BX.UI.InfoHelper.show(\''.self::$bitrix24helpCodes[$featureId].
'\');
',
379 'FEATURE_CODE
' => self::$bitrix24helpCodes[$featureId],
389 private static function isBitrix24(): bool
391 if (self::$bitrix24Included === null)
392 self::$bitrix24Included = Loader::includeModule('bitrix24
');
393 return self::$bitrix24Included;