Multiple catalog roots and cms roots



We have a requirement from a customer to handle different CMS structures and different Catalog rootes.

CMS Nodes:







And in the Commerce we have two different 2 catalogs (Private) and (Company) the url here can't be the same as CMS pages..we need to skip the first part in the url example:

/private/{CategoryName}/{SubCategory}/{Product} or /company/{CategoryName}/{SubCategory}/{Product}

How can i manage to resolve this issue? UrlRewriter? Custom HierarchicalCatalogPartialRouter?

Tnx in advance.

Jan 24, 2017 15:23


Thinking out load, cause I haven't actually tested this, but it might be possible by simply registering two HierarchicalCatalogPartialRouter.

Normally you would use the CatalogRouteHelper.MapDefaultHierarchialRouter method to register the route. And that will register the route using the root catalog node. However, the HierarchicalCatalogPartialRouter does support starting in an arbitrary part of a catalog. So if you forgo the CatalogRouteHelper.MapDefaultHierarchialRouter, and instead register two routes manually, it think that should give you your desired behavior. The would be registered something like:

RouteTable.Routes.RegisterPartialRouter(new HierarchicalCatalogPartialRouter(funcToGetPrivatePage, privateCatalogContent, false));
RouteTable.Routes.RegisterPartialRouter(new HierarchicalCatalogPartialRouter(funcToGetCompanyPage, companyCatalogContent, false));

I haven't actually tested it, so I might have missed something, but give it a try.


Per Gunsarfs

Jan 24, 2017 15:58

From an old post, but still will work

Theoratically only single definition will resolve the issue

Jan 24, 2017 17:18

Great i got it working with multible RegisterPartialRoute. But the url's is not getting resolved using UrlResolver.GetUrl() if i have two added. If i only add one the url's works but i need to have them both...

The Code that adds the routes:

// get the root page
var rootPage = contentLoader.Get<PageData>(ContentReference.RootPage);

// get the start page
var startPage = contentLoader.GetChildren<PageData>(rootPage.ContentLink).FirstOrDefault();

// get the different sub startpages /private /company
var subStartPages = contentLoader.GetChildren<PageData>(startPage.ContentLink);

foreach (var children in subStartPages)
     var existingCommerceCatalog = commerceRootContent.FirstOrDefault(x => x.Name.ToLower() == children.Name.ToLower());

     if (existingCommerceCatalog != null)
                var hierarchicalCatalogPartialRouter = new HierarchicalCatalogPartialRouter(() => children.ContentLink, existingCommerceCatalog, false);

Do i need to apply custom url resolving? 

Edited, Jan 25, 2017 9:55

@erikosterholm did you manage to solve the problem with UrlResolver.GetUrl() when having two HierarchicalCatalogPartialRouters? I'm experiencing the same problem.

I'm trying to add two (or more) catalogs and each one having thier first node child as catalog start so i can customize the new "catalog rootpage" (because you can't inherit from CatalogContent).

Apr 21, 2017 15:32

I'm curious if EPiServer have managed to enable having two HierarchicalCatalogPartialRouters? 

We really want different url's for each catalog root.

Mar 14, 2018 8:13

No, that is still not something we (officially) support.

Edited, Mar 14, 2018 9:30
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.