Bitrix Site Manager

CIBlockElement::GetProperty

CDBResult
CIBlockElement::GetProperty(
 int iblock_id,
 int element_id,
 string by = "sort",
 string order = "asc",
 array arFilter = Array()
);

The function returns values of the element properties.

Parameters

ParameterDescription
iblock_id Block ID.
element_id Element ID.
by Used to sort the result. Can be one of the following values:
  • id - by the property ID;
  • name - by the property name;
  • active - by the property active state;
  • sort - by the property sort weight.
Optional; the default value is sort.
order Optional sort order. Can be one of the following values:
  • asc - ascending;
  • desc - descending.
arFilter Optional additional filter in the form of Array("Filtered field"=>"Value", ...). The Filtered field can be the following:
  • ACTIVE - by the active state  (Y|N);
  • NAME - by name (wildcards [%_] allowed);
  • ID - by the ID;
  • PROPERTY_TYPE - by the property type;
  • CODE - by mnemonic code;
  • EMPTY - by empty fields.
By default, no additional filtering applied.

Return Values

Returns an instance of CDBResult containing fields of properties and the following fields:

See Also

  • CDBResult
  • Property fields

    Example


    <?
    $db_props = CIBlockElement::GetProperty($PRODUCT_IBLOCK_ID, 
                                            $PRODUCT_ID, "sort", 
                                            "asc", 
                                            Array("CODE"=>"FORUM_TOPIC_ID"));
    if ($ar_props = $db_props->Fetch())
        $FORUM_TOPIC_ID = IntVal($ar_props["VALUE"]);
    else
        $FORUM_TOPIC_ID = false;
    ?>