35 if (!isset($filter[
'IBLOCK_ID']))
41 $iblockId = (int)($filter[
'IBLOCK_ID']);
44 return new Page(
'PRODUCT_PROPERTIES', [], 0);
50 $this->getList($select, $filter, $order, $pageNavigation),
79 $this->addError(
new Error(
'The specified iblock is not a product catalog'));
84 if (!$iblockPermissionsCheckResult->isSuccess())
86 $this->addErrors($iblockPermissionsCheckResult->getErrors());
90 $typeCheckResult = $this->checkPropertyType($fields);
91 if (!$typeCheckResult->isSuccess())
93 $this->addErrors($typeCheckResult->getErrors());
97 $this->processCustomTypesBeforeAdd($fields);
100 $application->ResetException();
102 $addResult = (new \CIBlockProperty())->Add($fields);
105 if ($application->GetException())
107 $this->addError(
new Error($application->GetException()->GetString()));
111 $this->addError(
new Error(
'Error adding property'));
116 $this->processCustomTypesAfterAdd((
int)$addResult, $fields);
118 return [
'PRODUCT_PROPERTY' => $this->
get($addResult)];
128 $existsResult = $this->
exists($id);
129 if (!$existsResult->isSuccess())
131 $this->addErrors($existsResult->getErrors());
137 'PROPERTY_TYPE' => $fields[
'PROPERTY_TYPE'] ?? $property[
'PROPERTY_TYPE'],
138 'USER_TYPE' => $fields[
'USER_TYPE'] ?? $property[
'USER_TYPE'],
140 $typeCheckResult = $this->checkPropertyType($type);
141 if (!$typeCheckResult->isSuccess())
143 $this->addErrors($typeCheckResult->getErrors());
148 $application->ResetException();
150 $updateResult = (new \CIBlockProperty())->Update($id, $fields);
153 if ($application->GetException())
155 $this->addError(
new Error($application->GetException()->GetString()));
159 $this->addError(
new Error(
'Error updating product property'));
164 return [
'PRODUCT_PROPERTY' => $this->
get($id)];
173 $existsResult = $this->
exists($id);
174 if (!$existsResult->isSuccess())
176 $this->addErrors($existsResult->getErrors());
181 $application->ResetException();
183 $deleteResult = \CIBlockProperty::Delete($id);
186 if ($application->GetException())
188 $this->addError(
new Error($application->GetException()->GetString()));
192 $this->addError(
new Error(
'Error deleting product property'));