External Data Provider Implementation

  Written by The Jahia Team
 
Developers
   Estimated reading time:

This section shows how data is handled in Commerce IO.

Data Modeling

To get the most out of the SAP Hybris - Jahia integration, you must index the product catalog in Elasticsearch (ES). Indexing enables you to implement a performant External Data Provider (EDP) in Jahia so that users can enjoy standard edit mode features and use the ES index directly for speedy search queries at the page level. To achieve this the original catalog data structure was remodeled. After you index for the first time, you will notice that two indices are created. One index is the catalog that contains products. The second index is the category tree that is available on the site. Note that our modeling is the bare minimum to provide all needed functionality but you could always enhance your model to add additional features.

Product model

In the product model, consider the following key points when you customize search functionality:

  • In some cases, the model applies several different analysers to the same entry to provide additional flexibility.
  • Each product entry contains basic information such as a name and description and is uniquely identified by its SKU.
  • Each entry contains a mountedPath property which specifies the path for the product in the JCR.  Because the JCR is a tree structure, placing many children under the same node significantly degrades performance as the number of children increases. Therefore, a splitting rule generates the paths, balances the tree and helps to optimize performance. You can find details about the splitting rule in the org.jahia.modules.commerce.io.edp.datasource.model.Product class.
  • Each entry also contains a baseProduct property and variants property, if they exist for that product.

Note: You can find custom settings and mappings for the index in hybris-store module in src/main/resources/META-INF folder.

The following example shows the product object as stored in Elasticsearch.

{
"name": "The Rubber Re-Run",
"sku": "74818",
"code": "74818",
"summary": "...",
"baseProduct": "BK340962",
"price": { "currencyIso": "GBP","formattedValue": "£80.96","value": 80.96,"priceType": "FROM"},
"images": [...]
"mountedPath": "/p/hi/ib/dj/74818",
"vanityUrl": "/product/en/74818.html",
"extendedCategories": [...],
"variants": { "features": [ "style"],"style": [ "sky blue"]},
"selectedFeatures": null
}

Images are stored in the images array. The array provides basic information about the image type and path for images on your Hybris system.

The extendedCategories property is an array of available categories for a given product. The property is extended, meaning that it includes a category's name, ID, path, and path by ID.

Categories model

Categories are modelled to keep a flat view of the tree. As with products, there are settings and mappings that you can view for additional information on the index.

Each category entry has a name, path, idPath, children and childIds property. The idPath is a path to the category by category ID. The childIds property is an array containing child category IDs. The following example shows a category entry in Elasticsearch.

{
"name": "Eyewear Women",
"path": "/Categories/Eyewear-Women",
"idPath": "/categories/240000",
"children": [
"Shades-Women"
],
"childIds": [
"240100"
],
"id": "240000"
}