How to change the uCommerce "Current" Store , Catalog and/or Category
Hi again,
I am writing code base on the Razor Demo Store. I have the demo store running in Umbraco and I have previously written code to create a adjacent Store with it's own Stores , Catalogs , Categories & Products.
Now I m creating a Catalog page I have the following code:
uCommerce looks up by default for hostname bindings on your Store, if none is present then uCommerce will select the first store in your solution. So what you can do
Setup a hostname binding on your new store
Create a custom implementation of CatalogContext where you define which logic should be used for selecting your store.
Based on your suggestion I created the following code which solves the issue. I still have the same store as the first store but the Menu now populates from my new (second) store nased on that store's Catalog name:
How to change the uCommerce "Current" Store , Catalog and/or Category
Hi again,
I am writing code base on the Razor Demo Store. I have the demo store running in Umbraco and I have previously written code to create a adjacent Store with it's own Stores , Catalogs , Categories & Products.
Now I m creating a Catalog page I have the following code:
@RenderNavigation(CatalogLibrary.GetRootCategories(), SiteContext.Current.CatalogContext.CurrentCategory)
But is results in the display of the Catalogs , Categories & Products in the DEMO Store, not my new store and it's contents.
How do I change the "Current" Store , Catalog and/or Category so that this code shows information from my new store please.
Thanks
Terry Clancy
ClanceZ
Hi Terry,
uCommerce looks up by default for hostname bindings on your Store, if none is present then uCommerce will select the first store in your solution. So what you can do
best regards Martin
Thanks very much Martin,
Based on your suggestion I created the following code which solves the issue. I still have the same store as the first store but the Menu now populates from my new (second) store nased on that store's Catalog name:
@{ Category myCategory = newCategory();
ProductCatalog myProductCatalog = ProductCatalog.Find(x => x.Name == "MyCatalogName").First();
SiteContext.Current.CatalogContext.CurrentCatalog = myProductCatalog;
ICollection<Category> rootCategories = CatalogLibrary.GetRootCategories();
Category myCurrentCategory = rootCategories.First();
}
@RenderNavigation(rootCategories, myCurrentCategory);
Thanks again
Terry Clancy
ClanceZ
is working on a reply...