Override CatalogContext

CatalogContext determines which store, catalog and price group the customer uses at any given time. In this exercise, we will override the active catalog based on whether the customer is logged in or not.

 


Relevant APIs

UCommerce.Runtime
ICatalogContext
CatalogContext
.CurrentCatalogName

Hands-on

  1. New catalog "Private Catalog".
  2. New category "My Private Category".
  3. Add a few products to "My Private Category".
  4. Add new class in business logic, "MyCatalogContext".
  5. Override CurrentCatalogName property.
  6. Register MyCatalogContext in an App.
  7. Create a new folder in Apps.
  8. Remove existing components.
  9. Find existing catalog context in Configuration/Core.config.
  10. Copy in that component.
  11. Change type to use MyCatalogContext.

 

{{lineitem.ProductName}}

{{lineitem.VariantName}} - {{lineitem.Quantity}} x {{lineitem.FormattedPrice}} {{lineitem.FormattedPrice}}

Your cart is empty ;(
Total {{basket.FormattedProductsTotal}}
Checkout