David Abitbol
David Abitbol
Product Manager

After having successfully built a version of the Sitecore Commerce Connect module for the Commerce Orchestration™ platform, we learned a few very practical lessons. In this article, we’ll be looking at how we handled categories.

Product synchronization

The Commerce Connect module comes with the ability to synchronize your product catalog in Sitecore and gives you all the advantages of managing and accessing your products as Sitecore items. It also enables you to have related assets living in Sitecore so you can leverage its industry-leading asset management capabilities. But, the downfall of this method is that if you have a lot of products, the synchronization process can be very long and resource intensive.

On top of this, the synchronization process cannot handle the complexity of Commerce business modeling. Finally, Orckestra's search provider handles too much logic for us to ignore when synchronizing products.

In order to overcome this, we had to build a custom data provider and search provider for our products.

Data providers

Sitecore possesses this great functionality called data providers. Data Providers basically let you take control of the storage of Sitecore items in your own data store. Because the goal of this article is about what we did and not how to build data providers, you can dig deeper into the how in the Developers’ Introduction for Integrating External Data with Sitecore CMS 6.1, or an interesting article on The Black Art of Sitecore Custom Data Providers.

Since a catalog can have millions of products, some limitations of the data provider must be addressed, like the fact that the amount of products can overload the content tree in the content editor. But in this case, we have a solution to overcome it. The first thing we did was build a read-only data provider for just the categories, enabling us to easily navigate our catalog through Sitecore items.

 Furthermore, in the GetChildIds method, we do not fetch products - ever. This eliminates having products in the Sitecore tree.

 One feature that we absolutely wanted to have was the ability to change the layout of a category or be able to edit the renderings inside it. For that, if you look at any Sitecore item, you will see a few interesting fields:

1) _Renderings and _Final Renderings: This field will store all the renderings and layouts. This is what you modify when you edit the presentation details:

Sitecore Renderings

 Please note that the “Final Renderings” field is only available in Sitecore 8.

2) _Semantics: We use this field to add some tagging to our category or product

3) _Tracking: Very useful if you want to have your goals and attributes saved

4) Page level test set: This stores your active tests for the page

In order for us to be able to customize these per category, we had to override the SaveItem method:

 Sitecore SaveItem

Notice that we saved the item only if the renderings field has changed.

After this, you will successfully be able to customize the way a category landing page looks. This is extremely powerful in retail scenarios where you sell different types of items and want to have a unique look, for example, you wouldn’t want the details page of a shoe look like the details page of a tent.

David.