A
A
AndTheEnd2018-05-28 17:30:25
1C-Bitrix
AndTheEnd, 2018-05-28 17:30:25

How to display the properties of elements in a cycle through the Bitrix API?

Hello.
I need such structure.
Section -> Element -> Element properties.
I use the bitrix.catalog.section.list component.
Pulled the elements through result_modifier

<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();

$arSelect = Array("ID", "IBLOCK_ID", "NAME", "IBLOCK_SECTION_ID","PREVIEW_PICTURE","PROPERTY_*");
$arFilter = Array("IBLOCK_ID"=>$arParams["IBLOCK_ID"], "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array("SORT"=>"DESK"), $arFilter, false, false, $arSelect);

while($ob = $res->GetNextElement())
{
  $arFields = $ob->GetFields();
  $arSec[$arFields["IBLOCK_SECTION_ID"]][] = $arFields;
  $arProps = $ob->GetProperties();

}

foreach ($arResult['SECTIONS'] as $key => $arSection){
  $arResult['SECTIONS'][$key]["ELEMENTS"] = $arSec[$arSection["ID"]];
}
?>

I can not understand how else to pull out the properties
Wrote like this
foreach ($arResult['SECTIONS'] as $key => $arSection){
  $arResult['SECTIONS'][$key]["ELEMENTS"] = $arSec[$arSection["ID"]];
        $arResult['SECTIONS'][$key]["ELEMENTS"]["PROPS"] = $arProps[$arResult['SECTIONS'][$key]["ELEMENTS"]["ID"]]

Displays only the properties of the first element of each section.
Help me please.

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