<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
if(!CModule::IncludeModule("iblock")) return;
$arOrder = Array("NAME"=>"ASC");
$arFilter = Array("IBLOCK_ID"=>$arParams["IBLOCK_GOODS"]);
$arGroupBy = false;
$arNavStartParams = false;
$arSelectedFields = false;
$ItemsList = CIBlockElement::GetList($arOrder,$arFilter,$arGroupBy,$arNavStartParams,$arSelectedFields);
while($Items = $ItemsList->GetNextElement()) {
$arItems[] = Array(
"INGREDIENTS"=>$Items->GetProperty("INGREDIENTS"),
"SEC_SITE"=>$Items->GetProperty("SEC_SITE"),
"CML2_TRAITS"=>$Items->GetProperty("CML2_TRAITS"),
);
}
if (!isset($_REQUEST["BY_NOMEN"])) {
$arOrder = Array("NAME"=>"ASC");
$arFilter = Array("IBLOCK_ID"=>$arParams["IBLOCK_SITE_CATS"]);
$ListSections = CIBlockSection::GetList($arOrder, $arFilter, true);
while($Section = $ListSections->Fetch()) {
$arSections[] = $Section;
}
foreach ($arItems as $Items) :
$prop_ing = $Items["INGREDIENTS"];
$prop_sec = $Items["SEC_SITE"];
for ($i=0;$i<count($arSections);$i++) :
if(($prop_ing["VALUE_XML_ID"]==$_REQUEST["ING"])&&
(in_array($arSections[$i]['ID'],$prop_sec['VALUE']))) $arSections[$i]["EL_CNT"]++;
endfor;
endforeach;
} else {
$arOrder = Array("NAME"=>"ASC");
$arFilter = Array("IBLOCK_ID"=>$arParams["IBLOCK_NOMEN_CATS"]);
$ListSections = CIBlockSection::GetList($arOrder, $arFilter, true);
while($Section = $ListSections->Fetch()) {
$arSections[] = $Section;
}
foreach ($arItems as $Items) :
$prop_ing = $Items["INGREDIENTS"];
$prop_nomen = $Items["CML2_TRAITS"];
for ($i=0;$i<count($arSections);$i++) :
if(($prop_ing["VALUE_XML_ID"]==$_REQUEST["ING"])&&
($arSections[$i]['NAME']==$prop_nomen['VALUE'][0])) $arSections[$i]["EL_CNT"]++;
endfor;
endforeach;
}
$CurSec = CIBlockSection::GetByID(intval($_REQUEST['SECTION_ID']));
$arResult['CurSec'] = $CurSec->Fetch();
$arResult["SECTIONS"] = $arSections;
$this->IncludeComponentTemplate();
?>
|