...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmProductRestProxy
- Вызов: CCrmProductRestProxy::getProperties
public function getProperties($catalogID, &$fields, $propertiesSelect) { if ($catalogID <= 0) return; if(!is_array($fields)) { throw new RestException("The parameter 'fields' must be array."); } $productID = isset($fields['ID']) ? intval($fields['ID']) : 0; if ($productID <= 0) return; if (empty($propertiesSelect)) { return; } $this->initializePropertiesInfo($catalogID); $selectAll = false; foreach($propertiesSelect as $k => $v) { if($v === 'PROPERTY_*') { $selectAll = true; unset($propertiesSelect[$k]); break; } } $propertyValues = array(); if ($productID > 0 && count($this->properties) > 0) { $rsProperties = CIBlockElement::GetProperty( $catalogID, $productID, array( 'sort' => 'asc', 'id' => 'asc', 'enum_sort' => 'asc', 'value_id' => 'asc', ), array( 'ACTIVE' => 'Y', 'EMPTY' => 'N', 'CHECK_PERMISSIONS' => 'N' ) ); while ($property = $rsProperties->Fetch()) { if (isset($property['USER_TYPE']) && !empty($property['USER_TYPE']) && !array_key_exists($property['USER_TYPE'], $this->userTypes)) continue; $propId = 'PROPERTY_' . $property['ID']; if(!isset($propertyValues[$propId])) $propertyValues[$propId] = array(); $propertyValues[$propId][] = array('VALUE_ID' => $property['PROPERTY_VALUE_ID'], 'VALUE' => $property['VALUE']); } unset($rsProperties, $property, $propId); } foreach ($this->properties as $propId => $prop) { if ($selectAll || in_array($propId, $propertiesSelect, true)) { $value = null; if (isset($propertyValues[$propId])) { if ($prop['MULTIPLE'] === 'Y') $value = $propertyValues[$propId]; else if (count($propertyValues[$propId]) > 0) $value = end($propertyValues[$propId]); } $fields[$propId] = $value; } } }