Example #1
0
// 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);
	}
}


//AddMessage2Log($arFilter);
//AddMessage2Log($GLOBALS[$arParams["FILTER_NAME"]]);

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"]));
Example #2
0
function GetNonEmptyValuesForProps($iblockId, $sectionId, $propsCodes, $arFilter = Array())
{
    $props = Array();
    foreach($propsCodes as $propCode)
    {
        $props = array_merge($props,
            GetNonEmptyValuesForProp($iblockId,$sectionId,$propCode, $arFilter));
    }
    return $props;
}
Example #3
0
// 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];
       // AddMessage2Log($nonEmptyPropsValues);
    }
}

while ($prop_fields = $properties->GetNext())
{
    if ($prop_fields["PROPERTY_TYPE"] == "L"):
        $property_enums = CIBlockPropertyEnum::GetList(Array("DEF"=>"DESC", "SORT"=>"ASC"), Array("IBLOCK_ID"=>$iblockId, "CODE"=>$prop_fields["CODE"]));
        while($enum_fields = $property_enums->GetNext())
        {
            //AddMessage2Log('PROPERTY_'.$enum_fields['PROPERTY_CODE'].'_VALUE');
            //AddMessage2Log();