This is an excerpt from my second book . The first chapter is available to read for free.
A business is having an Episerver Commerce instance with multiple sites and multiple catalogs set up. They want to make sure each site will use one catalog, and all of them will share the same url for catalog structure. So it’ll be “https://site-a.com/products/category/”, and “https://site-b.com/products/category/”. Site A and site B are using different catalogs.
Is this doable? Yes! It’s just a matter of magic with the routing. This time, we would need to do an implementation of HierarchicalCatalogPartialRouter
ourselves. First, let’s create a template for it:
public class MultipleSiteCatalogPartialRouter : HierarchicalCatalogPartialRouter { private readonly IContentLoader _contentLoader; public MultipleSiteCatalogPartialRouter(FuncrouteStartingPoint, CatalogContentBase commerceRoot, bool enableOutgoingSeoUri, IContentLoader contentLoader) : base(routeStartingPoint, commerceRoot, enableOutgoingSeoUri) { _contentLoader = contentLoader; } }