How to access to Feed Property in Non-Recommendations Templates?
Hey there,
I need to create a combined Recommendation & Teaser template. The right part will be a normal Recommendation (there I have access to feed properties). The left part will be an image & text. But I need to get the image and the text from the feed properties as well.
I am aware, that feed properties are linked to a certain product. In this case it is enough to have access to the feed properties of the current product (in regards of the page context). Therefore a technical link to a certain product should be available. But I do not see any way to configure the template variables accordingly.
-
Commentaire officiel
Hi Malte,
If you’d like to pull information about a product from the product feed, you can use the following example:
DY.API('callback', function() { DY.ServerUtil.getProductsData(DY.recommendationContext.data, "", "", true, function(e, data) { var productInfo = data[DY.recommendationContext.data[0]].productData; document.querySelector('CSS Selector').textContent = productData.name; }); });This snippet is utilizing the getProductsData 3 API, which allows you to fetch products’ social proof information and feed properties.
if you want to access feed properties of the current context’s page they’re easily accessible in DY.feedProperties:
Actions pour les commentaires
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire