AI OnAI Off
you can create this structure as follows
Multiple Home pages
1 Catalogue
Your purposed structure is like below
Home1
If you create a property in Site Settings that just take Starting node against each home page
Product-1 can be in multiple categories (Shop & Shop2)
Now in the Commerce Initialization module, you can define how your commerce Urls rendered. You can specify like
{Home page}/{Starting Node}/
All products in starting nodes and sub-nodes will work and use your Product controller.
forgot to add a code snippet
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))]
public class InitializationModule : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
var referenceConverter = context.Locate.Advanced.GetInstance<Mediachase.Commerce.Catalog.ReferenceConverter>();
var contentLoader = context.Locate.Advanced.GetInstance<IContentLoader>();
var catalogs = contentLoader.GetChildren<CatalogContentBase>(referenceConverter.GetRootLink()).ToList();
if (!catalogs.Any()) return;
var siteDefinitionRepository = context.Locate.Advanced.GetInstance<ISiteDefinitionRepository>();
var siteDefinitions = siteDefinitionRepository.List();
foreach (var siteDefinition in siteDefinitions)
{
// Get your node from catalogue based on site defination
var catalogPartialRouter = new HierarchicalCatalogPartialRouter(() => siteDefinition.StartPage, your-desired-node, false);
RouteTable.Routes.RegisterPartialRouter(catalogPartialRouter);
}
}
public void Preload(string[] parameters) { }
public void Uninitialize(InitializationEngine context)
{
}
}
I am working on the episerver rebuild of a sitecore e-commerce website for a client and i am not sure how to recreate a particular piece of functionality they have. In their current site they can create a type of content node that works as a sort of wildcard for requests for product urls.
For instance, an editor could create a tree structure like this:
And then any request to “home1/shop/*” will go to the controller for ‘Product’ (such as “home1/shop/productOne”, “home1/shop/productTwo”).
They also need to do the same for different sites within the same solution, so a simplified version of the content tree would be:
So that any request to “home1/shop/*” and “home2/shop2/*” will go to the relevant controller. This means that both “home1/shop/productOne” and “home2/shop2/productOne” will return the product page but a url like “home2/shop3/productOne” will return a 404.
To be clear these two pages will show slightly different versions of the content for the product, so it is not just a case of a product being available in two different urls.
In addition this routing can’t be hard coded because it is based on the content type of the nodes. It must still be possible for an editor to create this in the content tree:
and then for a request to “home1/shop2/*” to return the correct product details.
does anyone know how best to receate this in episerver?