Sitecore Commerce 8.2.1 Api Getting Started

Catalog Foundation

Catalog Library
The catalog Library in sitecore commerce allows developers to retrieve any information required to display in browse context of a webhop concering navigation, price information url’s for products and related products. This article describes every method available and when to use them.

Getting all catalogs

If you have more than one catalog in your solution, you might want to display them in various ways instead of just resolving the current one.To achive this simply use the below method..

 ISearchIndex searchindex = ContentSearchManager.GetIndex("commerce_products_master_index");
using (IProviderSearchContext searchcontext = searchindex.CreateSearchContext((Sitecore.ContentSearch.Security.SearchSecurityOptions)0))
var query15 = searchcontext.GetQueryable<CommerceBaseCatalogSearchResultItem>()
.Where<CommerceBaseCatalogSearchResultItem>((Expression<Func<CommerceBaseCatalogSearchResultItem, bool>>)(item => item.CommerceSearchItemType == "Catalog"))
.Where<CommerceBaseCatalogSearchResultItem>((Expression<Func<CommerceBaseCatalogSearchResultItem, bool>>)(item => item.Language == "en")).Select(I => new { name = I.Name });

Getting the Catalogs and products is easy if your familiar with the sitecore content search api. The above method uses also uses the sitecore content search api for fetching the data from commerce data from the commerce product index


The above will return the all commerce catalogs which are indexed in to commerce products index.


Have any Question or Comment?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discussion Topics