Beispiel #1
0
 /// <summary>
 /// Gets the category.
 /// </summary>
 /// <param name="categoryId">The category unique identifier.</param>
 /// <param name="storeAlias">The store alias.</param>
 /// <param name="currencyCode">The currency code.</param>
 /// <returns></returns>
 public static ICategory GetCategory(int categoryId = 0, string storeAlias = null, string currencyCode = null)
 {
     if (categoryId == 0)
     {
         var currentCat = UwebshopRequest.Current.Category;
         if (storeAlias == null && currencyCode == null || currentCat == null)
         {
             return((ICategory)currentCat);
         }
         categoryId = currentCat.Id;
     }
     return(CategoryAdaptor.Create(DomainHelper.GetCategoryById(categoryId, storeAlias, currencyCode)));
 }
Beispiel #2
0
        private static void GetCategoriesFromCategory(ICollection <ICategory> categoryList, ICategory mainCategory)
        {
            foreach (var category in mainCategory.SubCategories.Where(category => categoryList.All(x => x.Id != category.Id)))
            {
                categoryList.Add(CategoryAdaptor.Create(category));
            }

            if (!mainCategory.SubCategories.Any())
            {
                return;
            }
            foreach (var subCategory in mainCategory.SubCategories)
            {
                GetCategoriesFromCategory(categoryList, subCategory);                 // todo: this can loop
            }
        }
Beispiel #3
0
 public static IEnumerable <ICategory> GetCurrentCategoryPath()
 {
     return(UwebshopRequest.Current.CategoryPath.Select(c => CategoryAdaptor.Create(DomainHelper.GetCategoryById(c.Id))));
 }