D
D
Diana2020-06-13 16:59:55
1C-Bitrix
Diana, 2020-06-13 16:59:55

How to get the desired value of the Bitrix product?

Dear programmers, coders, I ask for help

, there is such an array of data

[DISPLAY_PROPERTIES] => Array
        (
            [CML2_ARTICLE] => Array
                (
                    [ID] => 87
                    [IBLOCK_ID] => 11
                    [NAME] => Артикул
                    [ACTIVE] => Y
                    [SORT] => 50
                    [CODE] => CML2_ARTICLE
                    [DEFAULT_VALUE] => 
                    [PROPERTY_TYPE] => S
                    [ROW_COUNT] => 1
                    [COL_COUNT] => 30
                    [LIST_TYPE] => L
                    [MULTIPLE] => N
                    [XML_ID] => CML2_ARTICLE
                    [FILE_TYPE] => 
                    [MULTIPLE_CNT] => 5
                    [LINK_IBLOCK_ID] => 0
                    [WITH_DESCRIPTION] => N
                    [SEARCHABLE] => N
                    [FILTRABLE] => N
                    [IS_REQUIRED] => N
                    [VERSION] => 1
                    [USER_TYPE] => 
                    [USER_TYPE_SETTINGS] => 
                    [HINT] => 
                    [~NAME] => Артикул
                    [~DEFAULT_VALUE] => 
                    [VALUE_ENUM] => 
                    [VALUE_XML_ID] => 
                    [VALUE_SORT] => 
                    [VALUE] => 13811
                    [PROPERTY_VALUE_ID] => 504394
                    [DESCRIPTION] => 
                    [~VALUE] => 13811
                    [~DESCRIPTION] => 
                    [DISPLAY_VALUE] => 13811
                )

            [BRAND] => Array
                (
                    [ID] => 96
                    [IBLOCK_ID] => 11
                    [NAME] => Бренд
                    [ACTIVE] => Y
                    [SORT] => 200
                    [CODE] => BRAND
                    [DEFAULT_VALUE] => 
                    [PROPERTY_TYPE] => E
                    [ROW_COUNT] => 1
                    [COL_COUNT] => 30
                    [LIST_TYPE] => L
                    [MULTIPLE] => N
                    [XML_ID] => 4d4e5493-e0d1-11e8-8017-08606e46f9d4
                    [FILE_TYPE] => 
                    [MULTIPLE_CNT] => 5
                    [LINK_IBLOCK_ID] => 3
                    [WITH_DESCRIPTION] => N
                    [SEARCHABLE] => N
                    [FILTRABLE] => N
                    [IS_REQUIRED] => N
                    [VERSION] => 1
                    [USER_TYPE] => 
                    [USER_TYPE_SETTINGS] => 
                    [HINT] => 
                    [~NAME] => Бренд
                    [~DEFAULT_VALUE] => 
                    [VALUE_ENUM] => 
                    [VALUE_XML_ID] => 
                    [VALUE_SORT] => 
                    [VALUE] => 3814
                    [PROPERTY_VALUE_ID] => 483301
                    [DESCRIPTION] => 
                    [~VALUE] => 3814
                    [~DESCRIPTION] => 
                    [DISPLAY_VALUE] => Schleich
                    [LINK_ELEMENT_VALUE] => Array
                        (
                            [3814] => Array
                                (
                                    [ID] => 3814
                                    [~ID] => 3814
                                    [IBLOCK_ID] => 3
                                    [~IBLOCK_ID] => 3
                                    [NAME] => Schleich
                                    [~NAME] => Schleich
                                    [DETAIL_PAGE_URL] => /brands/schleich/
                                    [~DETAIL_PAGE_URL] => /brands/schleich/
                                    [PREVIEW_PICTURE] => 28322
                                    [~PREVIEW_PICTURE] => 28322
                                    [DETAIL_PICTURE] => 28323
                                    [~DETAIL_PICTURE] => 28323
                                    [SORT] => 500
                                    [~SORT] => 500
                                    [LANG_DIR] => /
                                    [~LANG_DIR] => /
                                    [CODE] => schleich
                                    [~CODE] => schleich
                                    [EXTERNAL_ID] => 3814
                                    [~EXTERNAL_ID] => 3814
                                    [IBLOCK_SECTION_ID] => 
                                    [~IBLOCK_SECTION_ID] => 
                                    [IBLOCK_TYPE_ID] => system
                                    [~IBLOCK_TYPE_ID] => system
                                    [IBLOCK_CODE] => brands
                                    [~IBLOCK_CODE] => brands
                                    [IBLOCK_EXTERNAL_ID] => lovekids_brands_s1
                                    [~IBLOCK_EXTERNAL_ID] => lovekids_brands_s1
                                    [LID] => s1
                                    [~LID] => s1
                                )

                        )

                )


I need to display the Brand value for microdata
, it turns out it lies
DISPLAY_PROPERTIES -> BRAND -> VALUE -> LINK_ELEMENT_VALUE -> NAME

To display the 3rd property, by nesting level, use this construction
<?=$arResult["PROPERTIES"]["PROPERTY_NAME"]["VALUE"]?>


And how to display the next level of nesting?

Can something similar be used?
$propDiana = $arResult['DISPLAY_PROPERTIES']['BRAND']['VALUE'];
print_r($propDiana);
$propDianaBrend = $arResult[$propDiana];
print_r($propDianaBrend);

print_r - used for debugging

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question