1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
productpropertysection.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog\Controller;
4
5use Bitrix\Iblock\SectionPropertyTable;
6use Bitrix\Main\Error;
7
9{
10 use ListAction; // default listAction realization
11
12 private const BLANK_SECTION = 0;
13
14 // region Actions
15
20
25 public function getAction(int $propertyId): ?array
26 {
27 $checkPropertyResult = $this->checkProperty($propertyId);
28 if (!$checkPropertyResult->isSuccess())
29 {
30 $this->addErrors($checkPropertyResult->getErrors());
31 return null;
32 }
33
34 return [$this->getServiceItemName() => $this->get($propertyId)];
35 }
36
42 public function setAction(int $propertyId, array $fields): ?array
43 {
44 $checkPropertyResult = $this->checkProperty($propertyId);
45 if (!$checkPropertyResult->isSuccess())
46 {
47 $this->addErrors($checkPropertyResult->getErrors());
48
49 return null;
50 }
51
52 $property = $this->getPropertyById($propertyId);
53 if (!$property)
54 {
55 $this->addError($this->getErrorEntityNotExists());
56
57 return null;
58 }
59 $fields['IBLOCK_ID'] = $property['IBLOCK_ID'];
60
61 \CIBlockSectionPropertyLink::Set(self::BLANK_SECTION, $propertyId, $fields);
62
63 $result = $this->get($propertyId);
64 if (!$result)
65 {
66 $this->addError(new Error('Error setting section properties'));
67 return null;
68 }
69
70 return [$this->getServiceItemName() => $this->get($propertyId)];
71 }
72
73 // endregion
74
78 protected function getEntityTable()
79 {
80 return SectionPropertyTable::class;
81 }
82
86 protected function checkPermissionEntity($name, $arguments = [])
87 {
88 if ($name === 'set')
89 {
90 return $this->checkModifyPermissionEntity();
91 }
92
93 return parent::checkPermissionEntity($name);
94 }
95
99 protected function get($id)
100 {
101 return SectionPropertyTable::getRow([
102 'filter' => ['=PROPERTY_ID' => $id],
103 'order' => ['IBLOCK_ID' => 'ASC'],
104 ]);
105 }
106
113 {
114 $params['filter']['PROPERTY.IBLOCK_ID'] = $this->getCatalogIds();
115 $params['order'] = empty($params['order']) ? ['IBLOCK_ID' => 'ASC'] : $params['order'];
116
117 return $params;
118 }
119}
checkPermissionEntity($name, $arguments=[])
Определения productpropertysection.php:86
setAction(int $propertyId, array $fields)
Определения productpropertysection.php:42
Определения error.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$name
Определения menu_edit.php:35
trait ListAction
Определения listaction.php:9
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$fields
Определения yandex_run.php:501