...Человеческий поиск в разработке...
- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/controller/product.php
- Класс: BitrixCatalogControllerProduct
- Вызов: Product::attachPropertyValues
protected function attachPropertyValues(array &$result, int $iblockId, array $propertyIds = []): void { if ($iblockId <= 0) { return; } $propertyFilter = !empty($propertyIds) ? ['ID' => $propertyIds] : []; $propertyValues = []; CIBlockElement::getPropertyValuesArray( $propertyValues, $iblockId, ['ID' => array_keys($result)], $propertyFilter, ['USE_PROPERTY_ID' => 'Y'] ); foreach ($result as $k => $v) { if (isset($propertyValues[$k])) { foreach ($propertyValues[$k] as $propId => $fields) { $value = null; if (isset($fields['PROPERTY_VALUE_ID'])) { if ($fields['PROPERTY_TYPE'] === IblockPropertyTable::TYPE_LIST) { if ($fields['MULTIPLE'] === 'Y') { if (is_array($fields['PROPERTY_VALUE_ID'])) { foreach ($fields['PROPERTY_VALUE_ID'] as $i => $item) { $value[] = [ 'VALUE' => $fields['VALUE_ENUM_ID'][$i], 'VALUE_ENUM' => $fields['VALUE_ENUM'][$i], 'VALUE_ID' => $fields['PROPERTY_VALUE_ID'][$i], ]; } } } else { $value = [ 'VALUE' => $fields['VALUE_ENUM_ID'], 'VALUE_ENUM' => $fields['VALUE_ENUM'], 'VALUE_ID' => $fields['PROPERTY_VALUE_ID'] ]; } } else { if ($fields['MULTIPLE'] === 'Y') { if (is_array($fields['PROPERTY_VALUE_ID'])) { foreach ($fields['PROPERTY_VALUE_ID'] as $i => $item) { $value[] = [ 'VALUE' => $fields['VALUE'][$i], 'VALUE_ID' => $fields['PROPERTY_VALUE_ID'][$i] ]; } } } else { $value = [ 'VALUE' => $fields['VALUE'], 'VALUE_ID' => $fields['PROPERTY_VALUE_ID'] ]; } } } $result[$k]['PROPERTY_' . $propId] = $value; } } elseif (!empty($propertyIds)) { /** * if property values are empty $propertyValues is empty */ foreach ($propertyIds as $propId) { $result[$k]['PROPERTY_' . $propId] = null; } } } }