Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Migrating Catalog Context

Catalog Context contains the catalog items your visitors are currently browsing.

    
    
        UCommerce.Runtime.SiteContext.Current.CatalogContext
    
    

To grab the new CatalogContext use the following:

    Ucommerce.Api.ICatalogContext catalogContext = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.ICatalogContext>();
    
    

The CatalogContext has been mapped one-to-one with the old. The only difference is that it will return dedicated models rather than entities.

E.g.

    
    
        UCommerce.EntitiesV2.Product product = UCommerce.Runtime.SiteContext.Current.CatalogContext.CurrentProduct
    
    

becomes

    Ucommerce.Search.Models.Product product = catalogContext.CurrentProduct;
    
    

The only noticeable change is the return type.