$arOrder=Array("SORT"=>"ASC");
$arFilter = Array("IBLOCK_ID"=>$arParams["IBLOCK_ID"]);
$ListEl = CIBlockSection::GetList($arOrder, $arFilter, true);
while($El = $ListEl->Fetch()) {
if ($El['DEPTH_LEVEL'] == 3) :
$arOrder = false;
$arFilter = Array(
"IBLOCK_ID"=>$arParams["IBLOCK_ID"],
"IBLOCK_SECTION_ID"=>$El["ID"],
);
$arGroupBy = Array("PROPERTY_INGREDIENTS");
$arSelectFields = false;
$ListElements = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, false, $arSelectFields);
$ElCnt = $ListElements->Fetch();
print_r($ElCnt);
$El["ING_EL_CNT"] = $ElCnt['CNT'];
$arEl[] = $El;
endif;
}
$arResult["El"] = $arEl; |