private void PopulateFacets(PanelContent panelContent, IConfiguration configuration, string locale, string currency) { if (panelContent == null || !panelContent.HasSubpanel("facets")) { return; } _facetGroups = ValueConverter.GetFacetGroups(configuration, panelContent.Subpanel("facets"), locale, currency, null); }
private static ISearchDocuments CreateSearchDocuments(PanelContent pc) { if (pc == null || !pc.HasSubpanel("search-results")) { return(EmptySearchDocuments()); } pc = pc.Subpanel("search-results"); if (!pc.HasSubpanel("search-hits")) { return(EmptySearchDocuments()); } pc = pc.Subpanel("search-hits"); if (!pc.HasResult) { return(EmptySearchDocuments()); } var documents = new SearchDocuments(); foreach (var product in pc.ResultAsProducts()) { var productDocument = new SearchDocument(); foreach (var field in product.Select(a => new SearchField(a.Name, a.Value))) { productDocument.Add(field); } documents.Add(productDocument); foreach (var variant in product.VariantList) { var variantDocument = new SearchDocument(); foreach (var field in variant.Select(a => new SearchField(a.Name, a.Value))) { variantDocument.Add(field); } documents.Add(variantDocument); } } documents.TotalCount = documents.Count; //Bug in SearchResults, SearchDocuments.TotalCount is never set implicitly. return(documents); }
public override IHierarchicalEnumerable Select() { if (string.IsNullOrEmpty(_viewPath)) { return(new PanelHierarchicalEnumerable(_rootPanel)); } if (!_rootPanel.HasSubpanel(_viewPath)) { return(new PanelHierarchicalEnumerable()); } return(new PanelHierarchicalEnumerable(_rootPanel.Subpanel(_viewPath))); }