27 parent::__construct();
35 public function use(): bool
37 if (defined(
'CATALOG_PRODUCT') && defined(
'SELF_FOLDER_URL'))
41 if (!$this->request->isAdminSection())
43 if ($this->checkCurrentPage([
45 self::PATH_DETAIL_CARD_PREFIX
65 if ($pageType !== self::PAGE_ELEMENT_LIST && $pageType !== self::PAGE_SECTION_LIST)
70 if (!Loader::includeModule(
'crm'))
77 if (AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_SETTINGS_ACCESS))
79 if (!\CCrmSaleHelper::isWithOrdersMode())
81 Extension::load([
'crm.config.catalog']);
84 'TEXT' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_INVENTORY_MANAGEMENT_SETTINGS'),
85 'TITLE' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_INVENTORY_MANAGEMENT_SETTINGS'),
86 'ONCLICK' =>
'BX.Crm.Config.Catalog.Slider.open(\'shop\')',
91 if (Catalog\
Config\Feature::isAccessControllerCheckingEnabled())
93 Extension::load(
'sidepanel');
96 'TEXT' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_ACCESS_RIGHTS'),
97 'TITLE' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_ACCESS_RIGHTS'),
98 'ONCLICK' =>
"BX.SidePanel.Instance.open('" . \CUtil::JSEscape(
'/shop/settings/permissions/') .
"')"
103 $helpLink = Catalog\Config\Feature::getAccessControllerHelpLink();
104 if (!empty($helpLink))
106 Catalog\Config\Feature::initUiHelpScope();
108 'TEXT' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_ACCESS_RIGHTS'),
109 'TITLE' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_ACCESS_RIGHTS'),
110 $helpLink[
'TYPE'] => $helpLink[
'LINK'],
117 'TEXT' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_SEO'),
118 'TITLE' =>
Loc::getMessage(
'CATALOG_SHOP_BUILDER_CONTEXT_MENU_ITEM_SEO'),
119 'ONCLICK' =>
"BX.SidePanel.Instance.open('"
120 . \CUtil::JSEscape($this->getCatalogSeoUrl())
121 .
"', {cacheable: false, allowChangeHistory: false, width: 1000})"
127 $result = array_merge($result, $items);
130 return (!empty($result) ? $result:
null);
140 parent::initConfig();
141 $this->config[
'UI_CATALOG'] = Catalog\Config\State::isProductCardSliderEnabled();
151 return (isset($this->config[
'UI_CATALOG']) && $this->config[
'UI_CATALOG']);
156 $path = $this->getSliderPath();
157 if (!$this->checkSliderPath($path))
161 $path = \CUtil::JSEscape($path);
163 $listUrl = \CUtil::JSEscape($this->getElementListUrl(0));
167 window.history.replaceState({},
'',
'$path');
168 BX.Event.ready(
function(){
169 BX.SidePanel.Instance.open(
173 onCloseComplete:
function(event) {
174 window.location =
'$listUrl';
190 protected function initUrlTemplates(): void
192 $this->urlTemplates[self::PAGE_SECTION_LIST] =
193 '/shop/catalog/#IBLOCK_ID#/section/#PARENT_ID#/'
194 .
'?#ADDITIONAL_PARAMETERS#'
196 $this->urlTemplates[self::PAGE_ELEMENT_LIST] =
197 '/shop/catalog/#IBLOCK_ID#/'
200 $this->urlTemplates[self::PAGE_SECTION_DETAIL] =
202 .
'cat_section_edit/'
205 .
'&publicSidePanel=Y'
206 .
'#ADDITIONAL_PARAMETERS#'
208 $this->urlTemplates[self::PAGE_SECTION_COPY] =
209 $this->urlTemplates[self::PAGE_SECTION_DETAIL]
210 . $this->getCopyAction()
212 $this->urlTemplates[self::PAGE_SECTION_SAVE] =
214 .
'cat_section_edit.php'
216 .
'#ADDITIONAL_PARAMETERS#'
218 $this->urlTemplates[self::PAGE_SECTION_SEARCH] =
219 '/bitrix/tools/iblock/section_search.php'
221 .
'#ADDITIONAL_PARAMETERS#'
226 $this->urlTemplates[self::PAGE_ELEMENT_DETAIL] =
227 self::PATH_DETAIL_CARD_PREFIX
228 .
'#IBLOCK_ID#/product/#ENTITY_ID#/'
229 .
'?#ADDITIONAL_PARAMETERS#'
231 $this->urlTemplates[self::PAGE_ELEMENT_COPY] =
232 self::PATH_DETAIL_CARD_PREFIX
233 .
'#IBLOCK_ID#/product/0/copy/#ENTITY_ID#/'
235 $this->urlTemplates[self::PAGE_ELEMENT_SAVE] = $this->urlTemplates[self::PAGE_ELEMENT_DETAIL];
236 $this->urlTemplates[self::PAGE_OFFER_DETAIL] =
238 .
'#PRODUCT_IBLOCK_ID#/product/#PRODUCT_ID#/'
239 .
'variation/#ENTITY_ID#/'
244 $this->urlTemplates[self::PAGE_ELEMENT_DETAIL] =
246 .
'cat_product_edit/'
249 .
'&publicSidePanel=Y'
250 .
'#ADDITIONAL_PARAMETERS#'
252 $this->urlTemplates[self::PAGE_ELEMENT_COPY] =
253 $this->urlTemplates[self::PAGE_ELEMENT_DETAIL]
254 . $this->getCopyAction()
256 $this->urlTemplates[self::PAGE_ELEMENT_SAVE] =
258 .
'cat_product_edit.php'
260 .
'#ADDITIONAL_PARAMETERS#'
262 $this->urlTemplates[self::PAGE_OFFER_DETAIL] = $this->urlTemplates[self::PAGE_ELEMENT_DETAIL];
264 $this->urlTemplates[self::PAGE_ELEMENT_SEARCH] =
265 '/bitrix/tools/iblock/element_search.php'
267 .
'#ADDITIONAL_PARAMETERS#'
269 $this->urlTemplates[self::PAGE_CATALOG_SEO] = self::PATH_DETAIL_CARD_PREFIX .
'#IBLOCK_ID#/seo/';
270 $this->urlTemplates[self::PAGE_ELEMENT_SEO] = self::PATH_DETAIL_CARD_PREFIX .
'#IBLOCK_ID#/seo/product/#PRODUCT_ID#/';
271 $this->urlTemplates[self::PAGE_SECTION_SEO] = self::PATH_DETAIL_CARD_PREFIX .
'#IBLOCK_ID#/seo/section/#SECTION_ID#/';
279 protected function getSliderPathTemplates(): array
282 '/^\/shop\/catalog\/[0-9]+\/product\/[0-9]+\/$/',
283 '/^\/shop\/catalog\/[0-9]+\/product\/[0-9]+\/variation\/[0-9]+\/$/',
287 public function openSettingsPage(): void
291 $this->request->get(
'open_settings_page')
292 && (
int)$this->request->get(
'open_settings_page') === 1
295 echo $this->getSettingsSlider();
299 protected function getSettingsSlider(): string
301 \Bitrix\Main\UI\Extension::load([
'crm.config.catalog']);
304 .
'BX.ready(function() {' .
"\n"
305 .
' BX.Crm.Config.Catalog.Slider.open(\'shop\');' .
"\n"
311 public function subscribeOnAfterSettingsSave(): void
313 $saveEventName = static::getOnSaveEventName();
315 if ($saveEventName !==
'')
317 $saveEventName = \CUtil::JSEscape($saveEventName);
320 .
'BX.addCustomEvent(\'' . $saveEventName .
'\',
function() {
' . "\n"
321 . ' var href = window.top.location.href;
' . "\n"
322 . ' window.top.location.replace(href.replace(/
' . \CUtil::JSEscape(static::OPEN_SETTINGS_PARAM) . '.*&?/, \
'\'));
' . "\n"
329 protected static function getOnSaveEventName(): string
331 return 'onCatalogSettingsSave
';
static getMessage($code, $replace=null, $language=null)