Ejemplo n.º 1
0
        public List <ProductFacetCount> FindProductCountsForKeys(List <string> sqlKeys)
        {
            List <ProductFacetCount> result = new List <ProductFacetCount>();

            foreach (string key in sqlKeys)
            {
                ProductFacetCount f = new ProductFacetCount();
                f.Key          = key;
                f.ProductCount = productValueRepository.FindCountProductIdsMatchingKey(key);
                result.Add(f);
            }
            return(result);
        }
        private void RenderNonSelection(StringBuilder sb, int index, long selectedValue, string key,
            CategoryFacet facet, ProductProperty property, List<ProductFacetCount> counts,
            CategoryPageViewModel model)
        {
            sb.Append("<h6 class=\"filter\">" + property.DisplayName + "</h6>");
            sb.Append("<ul class=\"filterselections\">");
            foreach (ProductPropertyChoice c in property.Choices)
            {
                string newKey = CategoryFacetKeyHelper.ReplaceKeyValue(key, index, c.Id);
                string baseUrl = model.LocalCategory.RewriteUrl + "?node=" + newKey;
                string sqlKey = CategoryFacetKeyHelper.ParseKeyToSqlList(newKey);
                ProductFacetCount fc = new ProductFacetCount();
                foreach (ProductFacetCount f in counts)
                {
                    if (f.Key == sqlKey)
                    {
                        fc = f;
                        break;
                    }
                }

                if (fc.ProductCount > 0)
                {
                    sb.Append("<li><a href=\"" + baseUrl + "\">");
                    sb.Append(c.ChoiceName);
                    sb.Append(" (" + fc.ProductCount.ToString() + ")");
                    sb.Append("</a></li>");
                }
            }
            sb.Append("</ul>");
        }