/// <summary> /// Returns all the categories of the category, including any sublevel categories /// </summary> /// <param name="categoryId">The category unique identifier.</param> /// <param name="storeAlias">The store alias.</param> /// <returns></returns> public static List <Category> GetCategoriesRecursive(int categoryId, string storeAlias = null) { var categoryList = new List <Category>(); GetCategoriesFromCategory(categoryList, DomainHelper.GetCategoryById(categoryId, storeAlias)); return(categoryList); }
private static void PublishedContentRequest_Prepared(object sender, EventArgs e) { var request = sender as PublishedContentRequest; if (request == null) { return; } var currentContent = request.PublishedContent; if (currentContent == null) { return; } if (ProductVariant.IsAlias(currentContent.DocumentTypeAlias) && currentContent.Parent != null) { var product = DomainHelper.GetProductById(currentContent.Parent.Id); if (product != null) { UwebshopRequest.Current.Product = (IProduct)product; } } else if (uWebshop.Domain.Product.IsAlias(currentContent.DocumentTypeAlias)) { var product = DomainHelper.GetProductById(currentContent.Id); if (product != null) { UwebshopRequest.Current.Product = (IProduct)product; } } else if (Category.IsAlias(currentContent.DocumentTypeAlias)) { var category = DomainHelper.GetCategoryById(currentContent.Id); if (category != null) { UwebshopRequest.Current.Category = (ICategory)category; } } }