Developer Considerations for Product Recommendations

Developer work to define product recommendations includes modifying ISML templates, defining content slots, providing a unique ID, along with other customizations.

When implementing product recommendations, keep the following in mind:

This example <islot> tag shows how to define a slot for use on a product detail page:

<isslot id="myslotid" context="global" context-object="${pdict.Product}"/>

This example shows how to define a slot for use on a category landing page:

<isslot id="cat-banner" context="category" context-object="${pdict.ProductSearchResult.category}" />

For defined content slots on your storefront, make sure to create a page template to render the recommended products. If you already have a template that renders other types of product content slots, you can reuse these templates with some modification. When reusing a template, copy it to the /templates/default/slots/recommendation/ folder.

The following example provides a product template for showing product recommendations:

<iscontent type="text/html" charset="UTF-8" compact="true"/>
<iscomment> should not be cached, the tiles are cached individually.</iscomment>

<isif condition="${slotcontent}">
<div class="product-listing product-listing-1x4">

        <ul class="search-result-items tiles-container">
                <isloop items="${slotcontent.content}" var="product" begin="0" end="3">
                        <isobject object="${product}" view="recommendation">
                                <li class="grid-tile">
                                        <isinclude url="${URLUtils.url('Product-HitTile',
                                                'pid', product.ID,
                                                'showswatches', 'true',
                                                'showpricing', 'true',
                                                'showpromotion', 'true',
                                                'showrating', 'true')}"/>


When developing slot-rendering templates for product recommendations, make sure that slot content caching is performed properly. Due to the dynamic nature of product recommendations, make sure not to cache the entire slot. If you cache the entire slot, every visitor experiences the same recommendations. Instead of caching the entire template, ensure that caching occurs when rendering individual product tiles.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.