private static void SetuCommerceContext(NiceUrl_Catalog catalog, NiceUrl_Category category, NiceUrl_Product product) { if(catalog != null) SiteContext.Current.CatalogContext.CurrentCatalog = catalog.GetuCommerceCatalog(); if(category != null) SiteContext.Current.CatalogContext.CurrentCategory = category.GetuCommerceCategory(); if(product != null) SiteContext.Current.CatalogContext.CurrentProduct = product.GetuCommerceProduct(); }
public static void UrlDecode(string[] splittedUrl, out NiceUrl_Catalog urlCatalog, out NiceUrl_Category urlCategory, out NiceUrl_Product urlProduct) { var repo = CreateRepository(); var cultureCode = GetCultureCode(); urlCatalog = repo.GetCatalog(splittedUrl[0], cultureCode); urlCategory = null; urlProduct = null; for (int i = 1; i < splittedUrl.Length; i++) { var innerCat = repo.GetCategory(splittedUrl[i], cultureCode,urlCatalog); if (innerCat != null) { urlCategory = innerCat; } else if(urlCategory != null) { var innerProduct = repo.GetProduct(splittedUrl[i], cultureCode, urlCategory); if (innerProduct != null) { urlProduct = innerProduct; } } } }