Multiple catalog roots and cms roots

Vote:
 

Hello,

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

CMS Nodes:

/private/

       /something-else

      {CATEGORY1}

/company/

       /something-else

      {CATEGORY1}

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.

#174330
Jan 24, 2017 15:23
Vote:
 

Hi

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.

Regards

Per Gunsarfs

#174335
Jan 24, 2017 15:58
Vote:
 

From an old post, but still will work http://world.episerver.com/blogs/Jonas-Bergqvist/Dates/2014/4/How-to-register-the-partial-routing-in-Commerce/

Theoratically only single definition will resolve the issue

#174341
Jan 24, 2017 17:18
Vote:
 

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);
                RouteTable.Routes.RegisterPartialRouter(hierarchicalCatalogPartialRouter);
         }
}

Do i need to apply custom url resolving? 

#174372
Edited, Jan 25, 2017 9:55
Vote:
 

@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).

#177885
Apr 21, 2017 15:32
Vote:
 

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

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

#189243
Mar 14, 2018 8:13
Vote:
 

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

#189250
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.