Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
inventorybuilder.php
1<?php
2
3namespace Bitrix\Catalog\Url;
4
6{
7 public const TYPE_ID = 'INVENTORY';
8
9 protected const TYPE_WEIGHT = 350;
10
11 protected const PATH_PREFIX = '/shop/documents-catalog/';
12
13 public function use(): bool
14 {
15 if (defined('URL_BUILDER_TYPE') && URL_BUILDER_TYPE === self::TYPE_ID)
16 {
17 return true;
18 }
19 if (!$this->request->isAdminSection())
20 {
21 if ($this->checkCurrentPage([
22 self::PATH_PREFIX,
23 ]))
24 {
25 return true;
26 }
27 }
28
29 return false;
30 }
31
32 protected function initUrlTemplates(): void
33 {
34 $this->urlTemplates[self::PAGE_SECTION_LIST] = '#PATH_PREFIX#'
35 .($this->iblockListMixed ? 'list/' : 'section_list/')
36 .'#PARENT_ID#/'
37 .'?#BASE_PARAMS#'
38 .'#PARENT_FILTER#'
39 .'#ADDITIONAL_PARAMETERS#';
40 $this->urlTemplates[self::PAGE_SECTION_DETAIL] = '#PATH_PREFIX#'
41 .'section/'
42 .'#ENTITY_ID#/'
43 .'?#BASE_PARAMS#'
44 .'&ID=#ENTITY_ID#'
45 .'#ADDITIONAL_PARAMETERS#';
46 $this->urlTemplates[self::PAGE_SECTION_COPY] = $this->urlTemplates[self::PAGE_SECTION_DETAIL]
47 .$this->getCopyAction();
48 $this->urlTemplates[self::PAGE_SECTION_SAVE] = '/bitrix/tools/catalog/section_save.php'
49 .'?#BASE_PARAMS#'
50 .'#ADDITIONAL_PARAMETERS#';
51 $this->urlTemplates[self::PAGE_SECTION_SEARCH] = '/bitrix/tools/iblock/section_search.php'
52 .'?#LANGUAGE#'
53 .'#ADDITIONAL_PARAMETERS#';
54
55 $this->urlTemplates[self::PAGE_ELEMENT_LIST] = '#PATH_PREFIX#'
56 .'list/'
57 .'#PARENT_ID#/'
58 .'?#BASE_PARAMS#'
59 .'#PARENT_FILTER#'
60 .'#ADDITIONAL_PARAMETERS#';
61 if ($this->isUiCatalog())
62 {
63 $this->urlTemplates[self::PAGE_ELEMENT_DETAIL] = '#PATH_PREFIX#'
64 . '#IBLOCK_ID#/product/#ENTITY_ID#/'
65 . '?#ADDITIONAL_PARAMETERS#';
66 $this->urlTemplates[self::PAGE_ELEMENT_COPY] = '#PATH_PREFIX#'
67 . '#IBLOCK_ID#/product/0/copy/#ENTITY_ID#/';
68 $this->urlTemplates[self::PAGE_ELEMENT_SAVE] = $this->urlTemplates[self::PAGE_ELEMENT_DETAIL];
69 $this->urlTemplates[self::PAGE_OFFER_DETAIL] = '#PATH_PREFIX#'
70 . '#PRODUCT_IBLOCK_ID#/product/#PRODUCT_ID#/'
71 . 'variation/#ENTITY_ID#/';
72 }
73 else
74 {
75 $this->urlTemplates[self::PAGE_ELEMENT_DETAIL] = '#PATH_PREFIX#'
76 .'product/'
77 .'#ENTITY_ID#/'
78 .'?#BASE_PARAMS#'
79 .'&ID=#ENTITY_ID#'
80 .'#ADDITIONAL_PARAMETERS#';
81 $this->urlTemplates[self::PAGE_ELEMENT_COPY] = $this->urlTemplates[self::PAGE_ELEMENT_DETAIL]
82 .$this->getCopyAction();
83 $this->urlTemplates[self::PAGE_ELEMENT_SAVE] = '/bitrix/tools/catalog/product_save.php'
84 .'?#BASE_PARAMS#'
85 .'#ADDITIONAL_PARAMETERS#';
86 $this->urlTemplates[self::PAGE_OFFER_DETAIL] = $this->urlTemplates[self::PAGE_ELEMENT_DETAIL];
87 }
88 $this->urlTemplates[self::PAGE_ELEMENT_SEARCH] = '/bitrix/tools/iblock/element_search.php'
89 .'?#LANGUAGE#'
90 .'#ADDITIONAL_PARAMETERS#';
91
92 $this->urlTemplates[self::PAGE_CATALOG_SEO] = self::PATH_PREFIX . '#IBLOCK_ID#/seo/';
93 $this->urlTemplates[self::PAGE_ELEMENT_SEO] = self::PATH_PREFIX . '#IBLOCK_ID#/seo/product/#PRODUCT_ID#/';
94 $this->urlTemplates[self::PAGE_SECTION_SEO] = self::PATH_PREFIX . '#IBLOCK_ID#/seo/section/#SECTION_ID#/';
95 }
96
97 protected function getSliderPathTemplates(): array
98 {
99 return [
100 '/^\/shop\/documents-catalog\/[0-9]+\/product\/[0-9]+\/$/',
101 '/^\/shop\/documents-catalog\/[0-9]+\/product\/[0-9]+\/variation\/[0-9]+\/$/',
102 ];
103 }
104}