public virtual CategoryNavigationViewModel CreateViewModel() { var categoryNavigationViewModel = new CategoryNavigationViewModel(); var rootCategories = CatalogLibrary.GetRootCategories().Where(x => x.DisplayOnSite).ToList(); var currentPriceGroup = SiteContext.Current.CatalogContext.CurrentPriceGroup; categoryNavigationViewModel.Categories = this.MapCategories(rootCategories, SiteContext.Current.CatalogContext.CurrentCategory); categoryNavigationViewModel.Currencies = this.MapCurrencies(SiteContext.Current.CatalogContext.CurrentCatalog.AllowedPriceGroups, currentPriceGroup); categoryNavigationViewModel.CurrentCurrency = new CategoryNavigationCurrencyViewModel() { DisplayName = currentPriceGroup.Name, PriceGroupId = currentPriceGroup.PriceGroupId, }; categoryNavigationViewModel.ProductDetailsPageId = this.productDetailsPageId; this.MapConfigurationFields(categoryNavigationViewModel); categoryNavigationViewModel.Routes.Add(RouteConstants.SEARCH_ROUTE_NAME, RouteConstants.SEARCH_ROUTE_VALUE); categoryNavigationViewModel.Routes.Add(RouteConstants.SEARCH_SUGGESTIONS_ROUTE_NAME, RouteConstants.SEARCH_SUGGESTIONS_ROUTE_VALUE); categoryNavigationViewModel.Routes.Add(RouteConstants.PRICE_GROUP_ROUTE_NAME, RouteConstants.PRICE_GROUP_ROUTE_VALUE); categoryNavigationViewModel.Routes.Add(RouteConstants.GET_BASKET_ROUTE_NAME, RouteConstants.GET_BASKET_ROUTE_VALUE); return(categoryNavigationViewModel); }
// GET: PartialView public ActionResult CategoryNavigation() { var cn = new CategoryNavigationViewModel(); ICollection <Category> rootCategories = CatalogLibrary.GetRootCategories(); cn.Categories = MapCategories(rootCategories); return(View("/views/PartialView/CategoryNavigation.cshtml", cn)); }
public ActionResult CategoryNavigation() { var categoryNavigationModel = new CategoryNavigationViewModel(); ICollection <Category> rootCategories = CatalogLibrary.GetRootCategories(); categoryNavigationModel.Categories = MapCategories(rootCategories); return(View("/views/PartialView/_HeaderMainMenuCategoryNav.cshtml", categoryNavigationModel)); }
public ActionResult CategoryNavigation() { var categoryNavigationModel = new CategoryNavigationViewModel(); ICollection <Category> rootCategories = CatalogLibrary.GetRootCategories().Where(x => x.DisplayOnSite).ToList(); categoryNavigationModel.Categories = MapCategories(rootCategories); return(View("/views/PartialView/CategoryNavigation.cshtml", categoryNavigationModel)); }
public List <Folder> GetFolders() { var folders = new List <Folder>(); foreach (var category in CatalogLibrary.GetRootCategories()) { var folder = GenerateFolderTree(category); folders.Add(folder); } return(folders); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (this.StopProcessing) { // Do not process } else { CategoryNavigationList.InnerHtml = ""; foreach (Category currentCategory in CatalogLibrary.GetRootCategories()) { RecursiveMenu(currentCategory); } } }
public List <KachingTag> GetAllTags() { return(GetTagsFromCategories(CatalogLibrary.GetRootCategories())); }
private IQueryable <Product> ApplyAutoSelection(Category currentCategory, string searchTerm) { IList <UCommerce.Documents.Product> products = null; var facetsResolver = new FacetResolver(this.queryStringBlackList); var facetsForQuerying = facetsResolver.GetFacetsFromQueryString(); if (currentCategory == null) { if (!string.IsNullOrWhiteSpace(searchTerm)) { var matchingProducts = Product.Find(p => p.VariantSku == null && p.DisplayOnSite && (p.Sku.Contains(searchTerm) || p.Name.Contains(searchTerm) || p.ProductDescriptions.Any(d => d.DisplayName.Contains(searchTerm) || d.ShortDescription.Contains(searchTerm) || d.LongDescription.Contains(searchTerm)))); return(matchingProducts.AsQueryable()); } else { var catalog = CatalogLibrary.GetAllCatalogs().FirstOrDefault(); if (catalog != null) { currentCategory = CatalogLibrary.GetRootCategories(catalog.Id).FirstOrDefault(); products = SearchLibrary.GetProductsFor(currentCategory, facetsForQuerying); if (currentCategory == null) { throw new InvalidOperationException(NO_CATEGORIES_ERROR_MESSAGE); } } else { throw new InvalidOperationException(NO_CATALOG_ERROR_MESSAGE); } } } else { products = SearchLibrary.GetProductsFor(currentCategory, facetsForQuerying); } ICollection <Product> productsInCategory = null; productsInCategory = CatalogLibrary.GetProducts(currentCategory).ToList(); if (!products.Any()) { return(productsInCategory.AsQueryable()); } var listOfProducts = new List <Product>(); foreach (var product in products) { var filterProduct = productsInCategory.FirstOrDefault(x => x.Sku == product.Sku && x.VariantSku == product.VariantSku); if (filterProduct != null) { listOfProducts.Add(filterProduct); } } return(listOfProducts.AsQueryable()); }