protected void BindSubCategories() { IList <Category> allCategories = CategoryDataSource.LoadForParent(this._categoryId, true); List <SubCategoryData> populatedCategories = new List <SubCategoryData>(); foreach (Category category in allCategories) { // SEARCH ALL CATEGORIES int totalProducts = ProductDataSource.AdvancedSearchCount(_keywords, category.Id, _manufacturerId, true, true, true, 0, 0, false, PageHelper.GetShopByChoices()); if (totalProducts > 0) { populatedCategories.Add(new SubCategoryData(category.Id, category.Name, category.NavigateUrl, totalProducts)); } } if (populatedCategories.Count > 0) { SubCategoryPanel.Visible = true; SubCategoryRepeater.DataSource = populatedCategories; SubCategoryRepeater.DataBind(); } else { SubCategoryPanel.Visible = false; } }
protected void BindSubCategories() { IList <Category> allCategories = CategoryDataSource.LoadForParent(this.CategoryId, true); List <SubCategoryData> populatedCategories = new List <SubCategoryData>(); foreach (Category category in allCategories) { int productCount = ProductDataSource.CountForCategory(true, category.Id, true, true); if (productCount > 0) { populatedCategories.Add(new SubCategoryData(category.Id, category.Name, category.NavigateUrl, productCount)); } } if (populatedCategories.Count > 0) { SubCategoryPanel.Visible = true; SubCategoryRepeater.DataSource = populatedCategories; SubCategoryRepeater.DataBind(); } else { SubCategoryPanel.Visible = false; } }