@A_Diana
seo-специалист

Как вытащить нужное значение товара Битрикс?

Уважаемые программисты, кодеры, прошу помощи

есть такой массив данных

[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
                                )

                        )

                )


Мне нужно вывести значение Бренд для микроразметки
получается оно лежит
DISPLAY_PROPERTIES -> BRAND -> VALUE -> LINK_ELEMENT_VALUE -> NAME

Чтобы вывести 3-ей свойство, по уровню вложенности, использую эту конструкцию
<?=$arResult["PROPERTIES"]["PROPERTY_NAME"]["VALUE"]?>


А как вывести следующий уровень вложенности?

Можно ли что-то подобное использовать?
$propDiana = $arResult['DISPLAY_PROPERTIES']['BRAND']['VALUE'];
print_r($propDiana);
$propDianaBrend = $arResult[$propDiana][['NAME']['VALUE']];
print_r($propDianaBrend);

print_r - использовала для отладки
  • Вопрос задан
  • 434 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы