Answer the question
In order to leave comments, you need to log in
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"]];
}
?>
foreach ($arResult['SECTIONS'] as $key => $arSection){
$arResult['SECTIONS'][$key]["ELEMENTS"] = $arSec[$arSection["ID"]];
$arResult['SECTIONS'][$key]["ELEMENTS"]["PROPS"] = $arProps[$arResult['SECTIONS'][$key]["ELEMENTS"]["ID"]]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question