public IList <AggregationRequest> GetAggregationRequests(ProductSearchCriteria criteria, FiltersContainer allFilters) { var result = new List <AggregationRequest>(); var browseFilters = _browseFilterService.GetBrowseFilters(criteria); if (browseFilters != null) { foreach (var filter in browseFilters) { var existingFilters = allFilters.GetFiltersExceptSpecified(filter.Key); var attributeFilter = filter as AttributeFilter; var priceRangeFilter = filter as PriceRangeFilter; var rangeFilter = filter as RangeFilter; AggregationRequest aggregationRequest = null; IList <AggregationRequest> aggregationRequests = null; if (attributeFilter != null) { aggregationRequest = GetAttributeFilterAggregationRequest(attributeFilter, existingFilters); } else if (rangeFilter != null) { aggregationRequests = GetRangeFilterAggregationRequests(rangeFilter, existingFilters); } else if (priceRangeFilter != null && priceRangeFilter.Currency.EqualsInvariant(criteria.Currency)) { aggregationRequests = GetPriceRangeFilterAggregationRequests(priceRangeFilter, criteria, existingFilters); } if (aggregationRequest != null) { result.Add(aggregationRequest); } if (aggregationRequests != null) { result.AddRange(aggregationRequests.Where(f => f != null)); } } } return(result); }
protected virtual IList <IFilter> GetFilters(FiltersContainer allFilters) { return(allFilters.GetFiltersExceptSpecified(null)); }