Documentation

GetProperties

array
_CIBElement::GetProperties(
   arOrder = Array("sort" => "asc"), 
   arFilter = Array()
);

The method returns property values of this information block element.

Parameters

ParameterDescription
arOrder Optional sort order. Array of the format Array(by1=>order1[, by2=>order2 [, ..]]) where by is the field for sorting. The field can have the following values:
  • id - property ID;
  • name - property name;
  • active - property active state;
  • sort - property sort weight.
order is the sort order. Can be asc for ascending sorts or desc for descending.
arFilter Optional additional filter in the form of Array("Filtered field"=>"Value", ...). The Filtered field can be the following:
  • NAME - by the property name;
  • ID - by the property ID;
  • ACTIVE - by the property active state  (Y|N). By default, only the active properties are returned; set this field empty to obtain all properties;
  • PROPERTY_TYPE - by the property type;
  • CODE - by the property mnemonic code;
  • EMPTY - by empty fields (Y|N). By default, all properties are returned, both with empty and meaningful properties.
By default, no additional filtering applied.

Return Values

The method returns the property values array with the key in the form of either symbolic code or the numeric ID and the value of an array containing the property fields and the additional keys and values:

  • "VALUE" => "property value or an array for a multiple property";
  • "VALUE_ENUM_ID" => "option ID for the LIST properties (array or a single value)";
  • "DESCRIPTION" => "property value description (array or a single value)";
  • "PROPERTY_VALUE_ID" => "property value ID (array or a single value)"

See Also

  • _CIBElement::GetProperties
  • CIBlockElement::GetProperty

    Example


    <?
    include($_SERVER['DOCUMENT_ROOT'].'/bitrix/header.php');
    if(CModule::IncludeModule('iblock'))
    {
        $dbEl = CIBlockElement::GetList(Array(), 
                                             Array("IBLOCK_TYPE"=>"catalog", 
                                                   "IBLOCK_ID"=>11));
        if($obEl = $dbEl->GetNextElement())
        {   
            $props = $obEl->GetProperties();
            echo "<pre>";
            print_r($props);
            echo "</pre>";
        }
    }
    ?>
    <?include($_SERVER['DOCUMENT_ROOT'].'/bitrix/footer.php');?>

    Sample output:


    Array
    (
        [27] => Array
            (
                [ID] => 27
                [TIMESTAMP_X] => 20041222191551
                [IBLOCK_ID] => 11
                [NAME] => Battery
                [ACTIVE] => Y
                [SORT] => 500
                [CODE] => 
                [DEFAULT_VALUE] => 
                [PROPERTY_TYPE] => L
                [ROW_COUNT] => 1
                [COL_COUNT] => 30
                [LIST_TYPE] => L
                [MULTIPLE] => Y
                [XML_ID] => 
                [FILE_TYPE] => 
                [MULTIPLE_CNT] => 5
                [TMP_ID] => 
                [WITH_DESCRIPTION] => 
                [LINK_IBLOCK_ID] => 0
                [VALUE_TYPE] => text
                [VALUE_ENUM] => Li-Mon
                [VALUE] => Array
                    (
                        [0] => Li-Test
                        [1] => Li-NEW
                        [2] => Li-Mon
                    )
    
                [~VALUE] => Array
                    (
                        [0] => Li-Test
                        [1] => Li-NEW
                        [2] => Li-Mon
                    )
    
                [DESCRIPTION] => Array
                    (
                        [0] => 
                        [1] => 
                        [2] => 
                    )
    
                [~DESCRIPTION] => Array
                    (
                        [0] => 
                        [1] => 
                        [2] => 
                    )
    
                [PROPERTY_VALUE_ID] => Array
                    (
                        [0] => 53860
                        [1] => 53861
                        [2] => 53862
                    )
    
                [VALUE_ENUM_ID] => Array
                    (
                        [0] => 18
                        [1] => 19
                        [2] => 20
                    )
    
                [~NAME] => Battery
                [~DEFAULT_VALUE] => 
            )
    
        [28] => Array
            (
                [ID] => 28
                [TIMESTAMP_X] => 20041222191551
                [IBLOCK_ID] => 11
                [NAME] => Screen
                [ACTIVE] => Y
                [SORT] => 500
                [CODE] => 
                [DEFAULT_VALUE] => 
                [PROPERTY_TYPE] => S
                [ROW_COUNT] => 1
                [COL_COUNT] => 30
                [LIST_TYPE] => L
                [MULTIPLE] => Y
                [XML_ID] => 
                [FILE_TYPE] => 
                [MULTIPLE_CNT] => 5
                [TMP_ID] => 
                [WITH_DESCRIPTION] => 
                [LINK_IBLOCK_ID] => 0
                [VALUE_TYPE] => 
                [VALUE_ENUM] => 
                [VALUE] => Color
                [~VALUE] => Color
                [DESCRIPTION] => 
                [~DESCRIPTION] => 
                [PROPERTY_VALUE_ID] => 32862
                [~NAME] => Screen
                [~DEFAULT_VALUE] => 
            )
    
        [29] => Array
            (
                [ID] => 29
                [TIMESTAMP_X] => 20041222191551
                [IBLOCK_ID] => 11
                [NAME] => PropertyX
                [ACTIVE] => Y
                [SORT] => 500
                [CODE] => 
                [DEFAULT_VALUE] => 
                [PROPERTY_TYPE] => N
                [ROW_COUNT] => 1
                [COL_COUNT] => 30
                [LIST_TYPE] => L
                [MULTIPLE] => Y
                [XML_ID] => 
                [FILE_TYPE] => 
                [MULTIPLE_CNT] => 5
                [TMP_ID] => 
                [WITH_DESCRIPTION] => 
                [LINK_IBLOCK_ID] => 0
                [VALUE_TYPE] => 
                [VALUE_ENUM] => 
                [VALUE] => 
                [~VALUE] => 
                [DESCRIPTION] => 
                [~DESCRIPTION] => 
                [PROPERTY_VALUE_ID] => 
                [~NAME] => PropertyX
                [~DEFAULT_VALUE] => 
            )
        [FORUM_TOPIC_ID] => Array
            (
                [ID] => 383
                [TIMESTAMP_X] => 20041223132810
                [IBLOCK_ID] => 11
                [NAME] => FORUM_TOPIC_ID
                [ACTIVE] => Y
                [SORT] => 500
                [CODE] => FORUM_TOPIC_ID
                [DEFAULT_VALUE] => 
                [PROPERTY_TYPE] => N
                [ROW_COUNT] => 1
                [COL_COUNT] => 30
                [LIST_TYPE] => L
                [MULTIPLE] => N
                [XML_ID] => 
                [FILE_TYPE] => 
                [MULTIPLE_CNT] => 5
                [TMP_ID] => 
                [WITH_DESCRIPTION] => 
                [LINK_IBLOCK_ID] => 0
                [VALUE_TYPE] => 
                [VALUE_ENUM] => 
                [VALUE] => 
                [~VALUE] => 
                [DESCRIPTION] => 
                [~DESCRIPTION] => 
                [PROPERTY_VALUE_ID] => 
                [~NAME] => FORUM_TOPIC_ID
                [~DEFAULT_VALUE] => 
            )
        [386] => Array
            (
                [ID] => 386
                [TIMESTAMP_X] => 20050119162457
                [IBLOCK_ID] => 11
                [NAME] => Photo
                [ACTIVE] => Y
                [SORT] => 500
                [CODE] => 
                [DEFAULT_VALUE] => 
                [PROPERTY_TYPE] => F
                [ROW_COUNT] => 1
                [COL_COUNT] => 30
                [LIST_TYPE] => L
                [MULTIPLE] => N
                [XML_ID] => 
                [FILE_TYPE] => 
                [MULTIPLE_CNT] => 5
                [TMP_ID] => 
                [WITH_DESCRIPTION] => Y
                [LINK_IBLOCK_ID] => 0
                [VALUE_TYPE] => text
                [VALUE_ENUM] => 
                [VALUE] => 2309
                [~VALUE] => 2309
                [DESCRIPTION] => HP
                [~DESCRIPTION] => HP 
                [PROPERTY_VALUE_ID] => 53863
                [~NAME] => Photo
                [~DEFAULT_VALUE] => 
            )
    )
  • © «Bitrix24», 2001-2024
    Up