Documentation

GetPropertyValues

)
 CIBlockElement::GetPropertyValues(
 $IBLOCK_ID, 
 $arElementFilter, 
 $extMode = false, 
 $propertyFilter = array()
);

The method gets property values for elements of a single iblock selected by filter.

Funciton paramters

Parameter Description
IBLOCK_ID Iblock ID (SINGLE value).
arElementFilter Filter CIBlockElement::GetList for selecting elements. No need to specify the IBLOCK_ID key - it will be added within the method.
extMode Attribute of expanded number of fields on returned on fetch. Optional.
propertyFilter Filter for returned properties. Optional. Can have only 1 key - ID. It is an array of ID's for returned properties. If empty - values of all iblock properties will be returned, including inactive ones.

Returned value

Returned value - object type CIBlockPropertyResult.

When $extMode = false, returns the following keys for each property value:

IBLOCK_ELEMENT_ID - element ID,
IBLOCK_PROPERTY_ID - property ID,
VALUE - property string value,
VALUE_NUM - property numeric value (applicable to such property types as number, list, binding to elements, sections, files and derived elements).

If $extMode = true, then additionally returns the keys:

PROPERTY_VALUE_ID - property ID in the database,
DESCRIPTION - property description (if available).

The result is sorted by the field IBLOCK_ELEMENT_ID

Examples

Get all property values with codes 10 and 14 for active elements of iblock 5

$iterator = CIBlockElement::GetPropertyValues(5, array('ACTIVE' => 'Y'), true, array('ID' => array(10, 14)));
while ($row = $iterator->Fetch())
{
  print_r($row);
}


© «Bitrix24», 2001-2024