ProductPropertyFeature::addAction

  1. Bitrix24 API (v. 23.675.0)
  2. catalog
  3. ProductPropertyFeature
  4. addAction
  • Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/controller/productpropertyfeature.php
  • Класс: BitrixCatalogControllerProductPropertyFeature
  • Вызов: ProductPropertyFeature::addAction
public function addAction(array $fields): ?array
{
	$checkFieldsResult = $this->checkFieldsBeforeModify($fields);
	if (!$checkFieldsResult->isSuccess())
	{
		$this->addErrors($checkFieldsResult->getErrors());
		return null;
	}

	$propertyId = (int)$fields['PROPERTY_ID'];
	unset($fields['PROPERTY_ID']);

	$addResult = PropertyCatalogFeature::addFeatures($propertyId, [$fields]);
	if (!$addResult->isSuccess())
	{
		$this->addErrors($addResult->getErrors());
		return null;
	}

	$propertyFeatureId = current($addResult->getData());
	return ['PRODUCT_PROPERTY_FEATURE' => $this->get($propertyFeatureId)];
}

Добавить комментарий