Skip to content

Catalog

Martin Goellnitz edited this page May 27, 2019 · 1 revision

Hierarchical Product Catalog

CoreMedia Content Cloud relies on the fact, that your commerce sytem will contain at least one catalog of products with a hierarchy of categories.

There may be more than one catalog, and each catalog may even hold more than one root element of the category hierarchy, but the very minimum is to have one catalog with one root category for a hierarchy.

Catalog Structure

The mock implementation of the catalog service only deals with one catalog in your Commerce system, while the dfferentiation of sevaral catalogs will be accomplished through the "store id" in the StoreContext instance.

Still the catalog can hold more than one root category.

*** Really ***

Implementations for Catalog Elements

Before we can fill the catalog hierarchy, we need to implement so called CommerceBean classes for our mock Commerce system. They implement the interfaces

  • Category
  • Product

Note for CoreMedia CMS users:

These beans are nearly the same as ContentBean instances that just happen to stem from another kind of repository.

The contents of the instances are taken from the API and local library through which we connect to the Commerce system.

Implement a Catalog Service

When browsing the catalog from the CoreMedia Studio, the first call taking place is findRootCategory().

For each returned category their respective sub-categories are requested (findSubCategories) and the products in the category are obtained (findProductsByCategory()).

Additionally it is necessary to be able to obtain categories and products directly by their ID: findCategoryById() and findProductById().

This means the implementation of the catalog service at the very least needs to contain non-dummy implementations for these methods.

When leaving out caching at this level, you will soon recognize that the CoreMedia Stuio cannot react very responsive and that some calls from the studio might time out with infinite spinning symbols in the catalog tree.

Take this as a sign, that the web output implementation and our live side of the production system will run into the same problem.

This results in the recommendation to start using Cache Keys for the discovery of categories and their contents.

  • findCategoryById()
  • findProductById()
  • findProductsByCategory()

Should return their result using the CoreMedia Content Cloud cache.

Be sure to take the correct element of your hierarchy as the root element and also be sure not to expose the contents of a default or "catch-all" category through the catalog service since this would result in a strange hierarchiy or the loading of all products from the commerce system into your Content Cloud instance e.g. when opening the catalog in the studio.

Clone this wiki locally