Catalog transformation

  Written by The Jahia Team
 
Developers
   Estimated reading time:

 

This section describes the transformation that occurs when categories and products are retrieved from Hybris Catalog and Elasticsearch Indexing.

Categories

Categories are retrieved as a hierarchy. A category can have subcategories. In the example Catalog, there can be up to 4 levels in the hierarchy, including the parent category.

For example: Collections → Shoes → Sandals → Sandals men.

When categories are indexed in Elasticsearch, they are flattened and added as entries that contain only the next level of children and children ID. Paths are then built recursively using the category name and category ID, for example: /collections/shoes/sandals/230400 where 230400 refers to Sandals men ID.

Hybris Response Object  - Representation of Categories (shortened for readability)

[
 {
   "name": "Collections",
   "id": "collections",
   "lastModified": "2018-05-17T14:35:53+0000",
   "subcategories": [
     {
       "name": "Caps",
       "id": "caps",
       "lastModified": "2018-05-17T14:35:16+0000",
       "subcategories": [
       ],
       "url": "/Categories/Clothes/Caps/c/caps"
     },
     {
       "name": "Shoes",
       "id": "shoes",
       "lastModified": "2018-05-17T14:36:21+0000",
       "subcategories": [
         {
           "name": "Sandals",
           "id": "sandals",
           "lastModified": "2018-05-17T14:35:53+0000",
           "subcategories": [
             {
               "name": "Sandals men",
               "id": "230400",
               "lastModified": "2018-05-17T14:35:14+0000",
               "subcategories": [
               ],
               "url": "/Categories/Shoes/Sandals-men/c/230400"
             },
             {
               "name": "Sandals women",
               "id": "400300",
               "lastModified": "2018-05-17T14:35:55+0000",
               "subcategories": [
               ],
               "url": "/Categories/Shoes-women/Sandals-women/c/400300"
             },
             {
               "name": "Sandals youth",
               "id": "390200",
               "lastModified": "2018-05-17T14:35:14+0000",
               "subcategories": [
               ],
               "url": "/Categories/Shoes-youth/Sandals-youth/c/390200"
             }
           ],
           "url": "/Categories/Clothes/Shoes/Sandals/c/sandals"
         }
       ],
       "url": "/Categories/Clothes/Shoes/c/shoes"
     },
     {
       "name": "Shirts",
       "id": "shirts",
       "lastModified": "2018-05-17T14:36:11+0000",
       "subcategories": [
       ],
       "url": "/Categories/Clothes/Shirts/c/shirts"
     },
     ...
   ],
   "url": "/Collections/c/collections"
 },

 ...

]

 

ElasticSearch Category Index - Representation of catalog mapping (shortened for readability)

{
 "_index": "apparelukfull_categories_en2018-06-08t16:55:45.508-04:00",
 "_type": "category",
 "_id": "AWPhL7J6YawqOSqBLjzx",
 "_version": 1,
 "_score": 1,
 "_source": {
   "name": "Collections",
   "path": "/Collections",
   "idPath": "/collections",
   "children": [
     "Caps",
     "Sunglasses",
     "Shoes",
     "Shirts",
     "Helmets",
     "Backpacks",
     "Snow",
     "Surf",
     "Kids",
     "Streetwear"
   ],
   "childIds": [
     "caps",
     "sunglasses",
     "shoes",
     "shirts",
     "helmet",
     "backpack",
     "snow",
     "surf",
     "kids",
     "streetwear"
   ],
   "id": "collections"
 }
}

 

Products

Product indexing is very similar to the Object returned from Hybris. The categories property is replaced with extendedCategories, that provides additional information which is retrieved from the Category response object. Additional properties are added to the index. A few important properties are:

  • sku(code)
  • vanityUrl
  • mountedPath(path in the JCR)
  • baseProduct

Hybris Response Object  - Representation of 1 Product (shortened for readability)

{
 "availableForPickup": true,
 "summary": "Negative side and blade angle for professional blade tuning. The tool used by alpine World Cup pros.",
 "images": [
   {
     "altText": "Snowboard Ski Tool Toko Side Edge Tuning Angle Pro 87 Grad",
     "format": "product",
     "imageType": "PRIMARY",
     "url": "/rest/v2/medias/?context=bWFzdGVyfGltYWdlc...jQyNg"
   },
   ...
 ],
 "purchasable": true,
 "code": "29532",
 "numberOfReviews": 0,
 "description": "",
 "url": "/apparel-uk/products/29532",
 "reviews": [
 ],
 "price": {
   "currencyIso": "GBP",
   "priceType": "BUY",
   "formattedValue": "£21.21",
   "value": 21.21
 },
 "productReferences": [
 ],
 "name": "Snowboard Ski Tool Toko Side Edge Tuning Angle Pro 87 Grad",
 "categories": [
   {
     "image": {
       "format": "96Wx96H",
       "url": "/rest/v2/medias/?context=bWFzdGVyfGltYWdlc...mU5MA"
     },
     "code": "Toko",
     "url": "/apparel-uk/catalogs/apparelProductCatalog/Online/categories/Toko"
   },
   {
     "code": "skigear",
     "url": "/apparel-uk/catalogs/apparelProductCatalog/Online/categories/skigear"
   },

   ...
 ],
 "potentialPromotions": [
 ],
 "stock": {
   "stockLevelStatus": "lowStock",
   "stockLevel": 1
 },
 "priceRange": {
   
 },
 "baseOptions": [
 ]
}

 
 

ElasticSearch Product Index - Representation of product mapping (shortened for readability)

{
 "_index": "apparelukfullen2018-06-13t13:24:09.200-04:00",
 "_type": "product",
 "_id": "7a832231-690b-4e7f-9ad3-b68a40e7cd79",
 "_version": 1,
 "_score": 1,
 "_source": {
   "name": "Shades Von Zipper Papa G black gloss black gloss/grey",
   "sku": "30404",
   "code": "30404",
   "summary": "Like a chunk of fudge on december 26th this super-sized piece of eye candy is the gift that keeps on giving into the New Year and doesn't melt in your hand or cause love handles",
   "baseProduct": null,
   "price": {
     "currencyIso": "GBP",
     "formattedValue": "£67.96",
     "value": 67.96,
     "priceType": "BUY"
   },
   "images": [
     {
       "altText": "Shades Von Zipper Papa G black gloss black gloss/grey",
       "format": "product",
       "imageType": "PRIMARY",
       "url": "/rest/v2/medias/?context=bWFzdGVyfGltYWdlc...TQ3OQ"
     },
     ...
   ],
   "mountedPath": "/p/fb/ba/fi/30404",
   "vanityUrl": "/product/en/30404.html",
   "extendedCategories": [
     {
       "categoryType": "brands",
       "shortIdUrl": "/brands/Von Zipper",
       "code": "Von Zipper",
       "shortUrl": "/Brands/Von-Zipper",
       "name": "Von Zipper",
       "categoryIdType": "brands"
     },
     {
       "categoryType": "collections",
       "shortIdUrl": "/collections/sunglasses",
       "code": "sunglasses",
       "shortUrl": "/Collections/Sunglasses",
       "name": "Sunglasses",
       "categoryIdType": "collections"
     },
     …

   ],
   "variants": null,
   "selectedFeatures": null
 }
}