- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/restview/product.php
- Класс: BitrixCatalogRestViewProduct
- Вызов: Product::externalizeFieldsGet
public function externalizeFieldsGet($fields, $fieldsInfo = []): array
{
// param - IBLOCK_ID is reqired in filter
$iblockId = (int)($fields['IBLOCK_ID'] ?? 0);
$productType = (int)($fields['TYPE'] ?? 0);
$propertyValues = $this->getFieldsIBlockPropertyValuesByFilter(['IBLOCK_ID' => $iblockId]);
$product = $this->getFieldsCatalogProductByFilter(['IBLOCK_ID' => $iblockId, 'PRODUCT_TYPE' => $productType]);
if ($product->isSuccess())
{
$fieldsInfo = array_merge(
$this->getFieldsIBlockElement(),
($propertyValues->isSuccess() ? $propertyValues->getData() : []),
$this->getFieldsCatalogProductCommonFields(),
$product->getData()
);
}
else
{
// if it was not possible to determine the view fields by product type,
// we get the default fields, all fields of the catalog and fields of the Information Block
$fieldsInfo = array_merge(
$this->getFields(),
($propertyValues->isSuccess() ? $propertyValues->getData() : [])
);
}
unset($product, $propertyValues);
return parent::externalizeFieldsGet($fields, $fieldsInfo);
}