Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Commerce catalog node propery fails to load


This problem is related to an upgraded site running Commece release 7.8.4.

I have a cms page that have property type defined like this:

   Name = "Catalog node",
   Description = "Select commerce catalog",
   Order = 2)]
public virtual ContentReference CatalogNode { get; set; }

When clicking on the catalog node property, the dialog opens and I can see the root catalog node. When I click to exand the children nodes, the following error is found in the console:

GET https://mycommecesite/episerver/cms/Stores/contentstructure/…s.nodecontentbase&allLanguages=true&sort()&dojo.preventCache=1402991042572 500 (Internal Server Error) 

And here is the stack trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Web.Routing.Segments.SegmentHelper.GetModifiedVirtualPathInEditOrPreviewMode(ContentReference contentLink, String virtualPath, ContextMode contextMode) +44
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.GetPartialVirtualPath(CatalogContentBase content, String language, RouteValueDictionary routeValues, RequestContext requestContext) +634
   EPiServer.Web.Routing.Segments.PartialSegment.GetVirtualPathSegment(RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues) +425
   EPiServer.Web.Routing.ContentRoute.AddVirtualPathFromSegments(StringBuilder virtualPath, RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues, Int32 lastNonDefaultIndex) +117
   EPiServer.Web.Routing.ContentRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +412
   EPiServer.Web.Routing.UrlResolver.GetUrlFromRoute(ContentReference contentRefernce, String language, RouteValueDictionary routeValues, RequestContext requestContext) +354
   EPiServer.Web.Routing.UrlResolver.GetVirtualPathInternal(ContentReference contentLink, String language, VirtualPathArguments arguments) +910
   EPiServer.Web.Routing.UrlResolver.GetUrl(ContentReference contentLink, String language, VirtualPathArguments virtualPathArguments) +14
   EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetVirtualPath(ContentReference contentLink, String language, ContextMode contextMode, Func`1 getVirtualPathAction) +485
   EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetUrl(ContentReference contentLink, String language, VirtualPathArguments virtualPathArguments) +272
   EPiServer.Cms.Shell.IContentExtensions.GetUrlForMode(IContent content, ContentReference requestedContentReference, ContextMode mode, UrlResolver urlResolver) +248
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.ContentDataModelBaseTransform.TransformInstance(IContent source, ContentDataStoreModelBase target, IModelTransformContext context) +687
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.<Execute>d__0.MoveNext() +341
Jun 17, 2014 9:53

The same error occurs when trying to browse commerce nodes from global menu (Commerce -> Catalog). Browsing the catalog inside Commerce Manager works without errors.

Jun 17, 2014 10:03

The problem is related to registering a HierarchicalCatalogPartialRouter in order to use a node as root for catalog routing - ref Jonas Blog post (last section):

If I go back to the default way of registering the route:

CatalogRouteHelper.MapDefaultHierarchialRouter(routes, false);

the catalog loads as expected.

Anyone that have inputs to this one? 

Jun 17, 2014 11:14

This might be too late for you, but I'll add it here for future visitors.

The error was caused as the routesegment of that node/entry is missing. Check your CatalogItemSeo table, the row might be missing or the RouteSegment column is null. Adding the information there (you can simple use the code as the routesegment) should solve the problem.



Feb 16, 2016 20:57

A little late, yes :) But thanks for adding the info.

Feb 18, 2016 20:03
* 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.