2

I am using Sitecore XC 9.0.3 with SXA.

On my SXA site I;

  • added a Catalog Item Container component,
  • assigned a product from the catalog (with item path /sitecore/content/New tenant/test/Home/Catalogs/TestCatalog/Product)
  • added Product Information component
  • saved

After saving I get the following error:

Error while rendering the view [Product Information] (item reference: [d09ebd2d-30f4-48b8-b7ab-0d6fce8c6c7b]) Please, make sure the rendering is configured properly or contact your administrator.
System.Web.HttpUnhandledException (0x80004005): An unhandled exception occurred. ---> System.InvalidOperationException: Catalog Item of the Storefront catalog Configuration cannot be found.
at Sitecore.Commerce.XA.Foundation.Common.Models.CommerceStorefront.get_CatalogItem()
at Sitecore.Commerce.XA.Foundation.Common.Models.CommerceStorefront.get_Catalog()
at Sitecore.Commerce.XA.Foundation.Connect.Entities.ProductEntity.Initialize(CommerceStorefront storefront, Item item, List`1 variantEntityList)
at Sitecore.Commerce.XA.Feature.Catalog.Repositories.BaseCatalogRepository.GetCatalogItemRenderingModel(IVisitorContext visitorContext, Item productItem)
at Sitecore.Commerce.XA.Feature.Catalog.Repositories.BaseCatalogRepository.GetProduct(IVisitorContext visitorContext)
at Sitecore.Commerce.XA.Feature.Catalog.Controllers.CatalogController.ProductInformation()

I confirmed that DataProvider.config as mentioned here is enabled.

I have a catalog selected at the following path: /sitecore/content/New tenant/test/Home/Catalogs (I guess otherwise it wouldn't be even possible to assign a product to the Catalog Item Container component).

I traced the error back to the following piece of code in the Sitecore.Commerce.XA.Foundation.Common.Models.CommerceStoreFront class:

public virtual Item CatalogItem
    {
      get
      {
        Field field = this.SiteCatalogConfiguration?.Fields[Sitecore.Commerce.XA.Foundation.Common.Constants.DataTemplates.SiteCatalogConfiguration.Fields.Catalog];
        if (field == null || string.IsNullOrWhiteSpace(field.Value))
          field = this.CatalogConfiguration.Fields[Sitecore.Commerce.XA.Foundation.Common.Constants.DataTemplates.CatalogConfiguration.Fields.Catalog];
        ID result;
        if (!ID.TryParse((object) field, out result))
          throw new InvalidItemException("Invalid catalog Id");
        Item obj = Sitecore.Context.Database.GetItem(result);
        Assert.IsNotNull((object) obj, "Catalog Item of the Storefront catalog Configuration cannot be found.");
        return obj;
      }
    }

Apparently the field in above code snippet is correctly retrieved, but the related item cannot be found.

What configuration step am I missing?

0

Solved it by selecting the proper catalog under:

/sitecore/content/New tenant/test/Settings/Commerce/Catalog Configuration

It seemed to be put at a, in my installation, non-existing Habitat Catalog value.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.