Try our conversational search powered by Generative AI!

Pick the right Catalog



If I have 2 catalog under Root,
is it possible to tell Commerce in HierarchicalCatalogPartialRouter to choose witch Catalog to take from?

Apr 08, 2020 11:42

HierarchicalCatalogPartialRouter includes the name of the catalog in the route, so I'd say this functionality is there out of the box. Example:



Apr 08, 2020 22:30

Hi Juan,

Please try the below code hope it will work in your case.

The HierarchicalCatalogPartialRouter class constructor takes two parameters one is the route starting point and another commerce root (catalog root). In commerce root, we can try to pass the second catalog root and then check it's work or not.

  • Root/category1
  • Root/category2

CatalogContent secondCatalog = contentLoader.GetChildren<CatalogContent>(rootLink).Skip(1).FirstOrDefault();

Func<ContentReference> startLink = () =>
? SiteDefinition.Current.RootPage
: SiteDefinition.Current.StartPage;

RouteTable.Routes.RegisterPartialRouter(new HierarchicalCatalogPartialRouter(startLink, secondCatalog, false));
Apr 13, 2020 12:55
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.