Every CXA Module - Foundation Catalog

6/22/2020 Architecture CXA Sitecore Sitecore Commerce SXA Helix

The main purpose of this Foundation Item is that it provides an easy way for you to link to your product and category items and resolve the current catalog item from the URL

OMG look how many ppl have commented

The main purpose of this Foundation Item is that it provides an easy way for you to link to your product and category items and resolve the current catalog item from the URL. For those of you who do not understand the basic structure of how Sitecore creates and resolves its links, they have a pipeline called a link provider which is called when the GenerateUrl() method is invoked on a Sitecore item in the page render process. This Link Provider is responsible for creating the correct URL path for the Page Item Resolver to consume and understand. So when the user clicks on the link, the Item Resolver takes in the URL, parses it, and resolves it to a Sitecore Item. CXA extended this concept to include catalog items. So there is a CatalogLinkProvider and a CatalogPageItemResolver which both live within this project.

So this basically handles the links for all the catalog items. Here are some of the main components associated with the layer

This module contains (but not limited to)...

  • Catalog Url Manager
    • This class basically does all the dirty work for both creating and interpreting the URL. It contains methods for building the link for a catalog item via either Direct or Wildcard navigation and methods for Extracting the catalog info from the URL
  • Base Product List Model, Product Summary View Model, Variant View Model
    • Basic models for presenting the product listing and summary to the feature layer for extension purposes
  • Catalog Page Item Resolver
    • Inside the Page Render Pipeline lives the Item Resolvers which are used for translating the URL to the correct Sitecore context item. One of these resolvers is the Catalog Page Item Resolver which sole responsibility is to first - determine if the user is on a product or category page via Wildcard or Direct Navigation, and second - get the current catalog item if on a product or category page and set it in the Storefront Context.This contacts the Catalog Url Manager
  • Resolve Catalog Context
    • This is a nifty little tool which will set your data source to the current catalog item if you set it in the catalogInformationRenderings node. This could be handy for producy/category summary modules
  • Catalog Link Provider
    • One great thing about Sitecore is that everything is configurable and easily extensible. For example, when generating a link for an item, Sitecore run through a series of Link Providers to return the proper link to the user. But the nifty thing about this is you can create as many of these Link Providers as you need to. CXA takes advantage of that by creating the Catalog Link Provider which checks if the item to generate a link from is a catalog item and communicates with the Catalog Url Manager to get the result URL.
  • Product Recommendations
    • This section of the project contains the logic for getting similar products based on either the users order or the current product they are viewing. OOB CXA logic gets the recommended products based on the RelatedSellableItemToSellableItem field on the product. This method, which lives in OrderBasedRecommendendProductsProvider and is called GetRelatedProductList, is a virtual method which may be overridden if you decide to extend and have a more complex business logic for getting similar products.

References

  • Sitecore.Commerce.XA.Foundation.Connect
  • Sitecore.Commerce.XA.Foundation.Common
  • Sitecore.Commerce.Engine.Connect
  • Sitecore.Commerce.Connect.Core

Referenced By

  • Sitecore.Commerce.XA.Feature.Catalog
  • Sitecore.Commerce.XA.Feature.Emails
  • Sitecore.Commerce.XA.Foundation.SiteMetadata