When aggregating data, Commerce Reference Store creates an actor chain that uses other nested actor chains. For example, in the actor ProductCatalogActor
for Store.Mobile.REST
:
<actor-chain id="sendViewItemEventGetRecentlyViewedProducts"> <droplet id="productLookup" name="/atg/commerce/catalog/ProductLookup" var="productLookupParamStack"> <input name="id" value="${(productId != null) ? productId : param.productId}" /> <input name="filterBySite" value="false" /> <oparam name="output"> <droplet id="productBrowsed" name="/atg/commerce/catalog/ProductBrowsed"> <input name="eventobject" value="${productLookupParamStack.element}" /> </droplet> </oparam> </droplet> <actor id="recentlyViewedProducts" name="/atg/commerce/catalog/ProductCatalogActor" chain-id="getRecentlyViewedProducts" return-model-var="recentlyViewedProducts"> <!-- inputs will come from the request parameters --> <output id="recentlyViewedProducts" name="recentlyViewedProducts" value="${recentlyViewedProducts.recentlyViewedProducts}" /> </actor> </actor-chain>
The actor ProductCatalogActor for Store.Mobile.REST
sends a view item event and then uses the nested actor ProductCatalogActor.getRecentlyViewedProducts
.
This example uses a request parameter to determine if the user wants recentlyViewedProducts
with the product item output:
<!-- optionally return recently viewed products along with the product --> <!-- also add list of properties that you can 'choose' to select a SKU (e.g. color, size) --> <actor-chain id="outputProduct"> <droplet id="skuProperties" name="/atg/dynamo/droplet/ForEach" var="forEachProperty"> <input name="array" value="${nucleus['/atg/commerce/catalog/CatalogTools'].propertyToLabelMap}" /> <oparam name="output"> <output id="skuProperties" name="product.skuProperties[${forEachProperty.index}]" value="${forEachProperty.key}" /> </oparam> </droplet> <droplet id="switch" name="/atg/dynamo/droplet/Switch" var="switch"> <input name="value" value="${param.getRecentlyViewedProducts}" /> <oparam name="true"> <actor id="recentlyViewedProducts" name="/atg/commerce/catalog/ProductCatalogActor" chain-id="getRecentlyViewedProducts" return-model-var="recentlyViewedProducts"> <!-- inputs come from request parameters --> <output id="recentlyViewedProducts" name="recentlyViewedProducts" value="${recentlyViewedProducts.recentlyViewedProducts}"/> </actor> </oparam> </droplet> </actor-chain>