<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
if (!empty($arResult) && CModule::IncludeModule('iblock')){
$i=0;
//Бегаем по свойствам
foreach($arResult["arrProp"] as $arProp):
$i++;
if ($i==2):
$arPropertyNames["f_models"][0]='<select id="'.$arResult["FILTER_NAME"].'_'."f_models".'" name="'.$arResult["FILTER_NAME"].'_pf['."f_models".']" style="width:100%">';
$arPropertyNames["f_models"][0].="<option value=''>==не выбрано==</option>";
$arPropertyNames["f_models"][0].="</select>";
endif;
$selected='';
foreach($arResult["ITEMS"] as $arItem):
if (strcmp(substr($arItem["INPUT_NAME"],19,strlen($arItem["INPUT_NAME"])-20),$arProp["CODE"])==0):
$selected=$arItem["INPUT_VALUE"];
endif;
endforeach;
if (strcmp($arProp["CODE"],'f_manufacturers')==0):
if (strcmp($arProp["CODE"],'f_manufacturers')==0):
$arFilter = array(
"IBLOCK_ID"=>'53',
"ACTIVE"=>"Y",
"IBLOCK_ACTIVE" => "Y",
"PROPERTY"=>array('!f_manufacturers'=>false,'!f_year'=>false),
);
$arGroupBy = Array(strtoupper("PROPERTY_".$arProp["CODE"]));
$arPropertyNames[$arProp["CODE"]][0]='<select id="'.$arResult["FILTER_NAME"].'_'.$arProp["CODE"].'" name="'.$arResult["FILTER_NAME"].'_pf['.$arProp["CODE"].']" style="width:100%" >';
$arPropertyNames[$arProp["CODE"]][0].="<option value=''>==не выбрано==</option>";
$db_list = CIBlockElement::GetList(Array(strtoupper("PROPERTY_".$arProp["CODE"])=>"ASC"),$arFilter,$arGroupBy);
while($ob = $db_list->GetNextElement()){
$arFields = $ob->GetFields();
$valP=$arFields[strtoupper('PROPERTY_'.$arProp["CODE"].'_VALUE')];
if ($selected==$valP):
$arPropertyNames[$arProp["CODE"]][0].="<option value='".$valP."' selected>".$valP."</option>";
else: $arPropertyNames[$arProp["CODE"]][0].="<option value='".$valP."'>".$valP."</option>";
endif;
}
$arPropertyNames[$arProp["CODE"]][0].="</select>";
endif;
else:
$arPropertyNames[$arProp["CODE"]][0]='<select id="'.$arResult["FILTER_NAME"].'_'.$arProp["CODE"].'" name="'.$arResult["FILTER_NAME"].'_pf['.$arProp["CODE"].']" style="width:100%">';
$arPropertyNames[$arProp["CODE"]][0].="<option value=''>==не выбрано==</option>";
$arPropertyNames[$arProp["CODE"]][0].="</select>";
endif;
endforeach;
$arResult["newPropArray"]=$arPropertyNames;
}
?>
|