Storing presentational information¶
Presentational information is data that isn't intended to be used in search, filters or facets, e.g. data that is used by the frontend code to render a part of a page.
The recommendation is to keep this kind of data out of Elevate since it increases the response size and might cause strange search hits. However, it might not always be possible to omit this kind of information because of the difficulty of getting data from other system.
Products and variants¶
If this type of data needs to be stored in products or variants in Elevate, it should be stored as a JSON blob, as it will NOT be indexed. Group related data together in an attribute to minimize the number of attributes and store only the necessary information. The json blob should be stored as a custom attribute in Admin v3 or as a custom json field in Admin v4.
The custom attribute or custom json field will be returned in a product-page request and can be included in listings via presentCustom
or by using a template that includes that attribute or field.
Example¶
The following examples shows a variables that control the UI on a product page showPDPBanner
, and also an internalId
that shouldn't be searchable. If internalId
was stored as a regular custom attribute and another custom attribute contained a value with cm
e.g. 55 cm
, a search for 15 cm
would result in the product being listed.
<!-- on product or variant -->
<custom_attributes>
<display_information>{"showPDPBanner": true, "internalId": 15}</display_information>
</custom_attributes>
// on ProductData and VariantData
{
"customJson": {
"displayInformation": {
"showPDPBanner": true,
"internalId": 15
}
}
}
Landing pages¶
If there is presentational information related to a category, it can be saved on the field customData
for each locale on a page.
The customData
field will be returned on landing-page requests.
Example¶
{
"market" : "se",
"type" : "FULL",
"addOrUpdate" : [ {
"id" : "/women/shirts",
"customData" : {
"en-GB" : {
"showBanner": true,
"showBannerExpanded": true,
"bannerImage" : "/assets/banners/sale_01.jpg"
},
"sv-SE": {
"showBanner": true,
"showBannerExpanded": false,
"bannerImage" : "/assets/banners/sale_01.jpg"
}
}
} ]
//.. omitted for brevity
}
Navigation¶
If the nodes in the navigation require presentational information it can be stored on the field customData
. The customData
field will be returned on landing-page requests as well as requests to the navigation-tree.
Example¶
{
"locale" : "sv-SE",
"market" : "se",
"type" : "FULL",
"addOrUpdate" : [ {
"id" : "/women/shirts",
"title" : "Shirts",
"type" : "PAGE",
"customData" : {
"highlight" : "true",
"viewableFrom" : "2010-10-20 00:00:00"
},
//.. omitted for brevity
} ]
}