<?if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED!==true) die(); // свойства инфобока для фильтра $arFilter = Array("ACTIVE"=>"Y", "IBLOCK_ID"=>$arResult["IBLOCK_ID"]); $propFilter = $GLOBALS[$arParams["FILTER_NAME"]]; $properties = CIBlockProperty::GetList(Array("sort"=>"asc", "name"=>"asc"), $arFilter); require($_SERVER["DOCUMENT_ROOT"]."/include/section_props.php"); $nonEmptyPropsValues = GetNonEmptyPropsValues($arResult["IBLOCK_ID"], $arResult["ID"], array_merge($arFilter,$propFilter)); // count($GLOBALS[$arParams["FILTER_NAME"]]) can be 0 or 1 if (count($propFilter)>0) { // if filter by some property is set, then // we should reset that filter to retrieve nonempty values of that prop foreach($propFilter as $key => $value) { // we use foreach despite of the fact that $GLOBALS[$arParams["FILTER_NAME"]] can // have at most 1 element because it is the one the fastest ways to get key and value // get prop code $start = strpos($key, '_')+1; $end = strrpos($key,'_'); $propCode = substr($key, $start, $end-$start); $valuesOfPropWithFilter = GetNonEmptyValuesForProp($arResult["IBLOCK_ID"], $arResult["ID"], $propCode); //AddMessage2Log($nonEmptyPropsValues); //$nonEmptyPropsValues[$propCode] = array_merge($nonEmptyPropsValues[$propCode],$valuesOfPropWithFilter[$propCode]); $nonEmptyPropsValues[$propCode]=$valuesOfPropWithFilter[$propCode]; //AddMessage2Log($nonEmptyPropsValues);
<?if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED!==true) die(); // свойства инфобока для фильтра $arFilter = Array("ACTIVE"=>"Y", "IBLOCK_ID"=>$arResult["IBLOCK_ID"]); $properties = CIBlockProperty::GetList(Array("sort"=>"asc", "name"=>"asc"), $arFilter); require($_SERVER["DOCUMENT_ROOT"] . "/include/section_props.php"); $nonEmptyProps = GetNonEmptyPropsValues($arResult["IBLOCK_ID"], $arResult["ID"]); //AddMessage2Log($arResult["IBLOCK_ID"]); //AddMessage2Log($arResult["ID"]); //AddMessage2Log($nonEmptyProps); //AddMessage2Log($arParams); $arResult["BRAND_NAME"] = $arParams["SECTION_USER_FIELDS"][0]; while ($prop_fields = $properties->GetNext()) { if ($prop_fields["PROPERTY_TYPE"] == "L"): $property_enums = CIBlockPropertyEnum::GetList(Array("DEF"=>"DESC", "SORT"=>"ASC"), Array("IBLOCK_ID"=>$arResult["IBLOCK_ID"], "CODE"=>$prop_fields["CODE"])); while($enum_fields = $property_enums->GetNext()) { //AddMessage2Log($nonEmptyProps[$enum_fields["PROPERTY_CODE"]]); if (in_array($enum_fields["VALUE"], $nonEmptyProps[$enum_fields["PROPERTY_CODE"]])) $prop_fields["ENUM_LIST"][] = $enum_fields; } endif; $arProperties[$prop_fields["CODE"]] = $prop_fields; } $arResult["PROPERTIES_IBLOCK"] = $arProperties;
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); $sectionId = $arResult["SECTION"]["ID"]; $iblockId =$arParams["IBLOCK_ID"]; $arFilter = Array("ACTIVE"=>"Y", "IBLOCK_ID"=>$iblockId); $propFilter = $GLOBALS[$arParams["FILTER_NAME"]]; $properties = CIBlockProperty::GetList(Array("sort"=>"asc", "name"=>"asc"), $arFilter); require_once($_SERVER["DOCUMENT_ROOT"]."/include/section_props.php"); //AddMessage2Log($propFilter); $nonEmptyPropsValues = GetNonEmptyPropsValues($iblockId, $sectionId, array_merge($arFilter,$propFilter)); // count($GLOBALS[$arParams["FILTER_NAME"]]) can be 0 or 1 if (count($propFilter)>0) { // if filter by some property is set, then // we should reset that filter to retrieve nonempty values of that prop foreach ($propFilter as $key => $value) { // we use foreach despite of the fact that $GLOBALS[$arParams["FILTER_NAME"]] can // have at most 1 element because it is the one the fastest ways to get key and value // get prop code $start = strpos($key, '_')+1; $end = strrpos($key,'_'); $propCode = substr($key, $start, $end-$start); $valuesOfPropWithFilter = GetNonEmptyValuesForProp($iblockId, $sectionId, $propCode); //AddMessage2Log($nonEmptyPropsValues); //$nonEmptyPropsValues[$propCode] = array_merge($nonEmptyPropsValues[$propCode],$valuesOfPropWithFilter[$propCode]); $nonEmptyPropsValues[$propCode] = $valuesOfPropWithFilter[$propCode];