public StoreLiquidResult GetProductsSearchPage(Controller controller, ProductsSearchResult productSearchResult, PageDesign pageDesign, List <ProductCategory> categories, String search, String filters, String headerText, String categoryApiId) { var dic = new Dictionary <String, String>(); dic.Add(StoreConstants.PageOutput, ""); var items = new List <ProductLiquid>(); var cats = new List <ProductCategoryLiquid>(); var products = productSearchResult.Products; var filterGroups = productSearchResult.FiltersGroups; var httpContextRequest = controller.Request; foreach (FilterGroup filterGroup in filterGroups) { foreach (Data.HelpersModel.Filter filter in filterGroup.FiltersHidden) { if (string.IsNullOrEmpty(filter.Text)) { continue; } filter.FilterLink = filter.Link(httpContextRequest); } } var filtersList = FilterHelper.GetFiltersFromContextRequest(httpContextRequest); foreach (var filter in filtersList) { filter.FilterLink = filter.LinkExclude(httpContextRequest, productSearchResult.Stats.OwnerType); } foreach (var item in products) { var category = categories.FirstOrDefault(r => r.Id == item.ProductCategoryId); if (category != null) { var blog = new ProductLiquid(item, category, ImageWidth, ImageHeight); items.Add(blog); } } var selectedCategory = categories.FirstOrDefault(r => r.ApiCategoryId.Equals(categoryApiId, StringComparison.InvariantCultureIgnoreCase)); ProductCategoryLiquid selectedCategoryLiquid = null; if (selectedCategory == null) { selectedCategory = categories.FirstOrDefault(); } selectedCategoryLiquid = new ProductCategoryLiquid(selectedCategory); var categoryTree = controller.RenderPartialToStringCache( "pCreateCategoryTree", new ViewDataDictionary(categories)); object anonymousObject = new { filterExcluded = LiquidAnonymousObject.GetFilters(filtersList), filterGroup = LiquidAnonymousObject.GetFilterGroup(filterGroups), products = LiquidAnonymousObject.GetProductsLiquid(items), selectedCategory = LiquidAnonymousObject.GetProductCategory(selectedCategoryLiquid), categoryTree = categoryTree, search = search, filters = filters, headerText = headerText, recordsTotal = productSearchResult.Stats.RecordsTotal, isCleanButton = !String.IsNullOrEmpty(search) || !String.IsNullOrEmpty(filters) }; var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject); dic[StoreConstants.PageOutput] = indexPageOutput; dic.Add(StoreConstants.PageSize, productSearchResult.PageSize.ToStr()); dic.Add(StoreConstants.PageNumber, productSearchResult.Stats.PageCurrent.ToStr()); dic.Add(StoreConstants.TotalItemCount, productSearchResult.Stats.RecordsTotal.ToStr()); var result = new StoreLiquidResult(); result.PageDesingName = pageDesign.Name; result.LiquidRenderedResult = dic; if (selectedCategory != null) { result.PageTitle = selectedCategory.Name + " Products"; } else { result.PageTitle = "Products"; } return(result); }