Constsdk.on(InMessageRequestArticleInfo, (e) => {
for (const article of e.event.articles) {
// fetch article info from your database
const a = await fetchMyShopArticleInfo(article.ean, article.manufacturerArticleNumber)
e.respond(OutMessageArticleInfo.create({
article,
articleNumber: a.articleNumber,
info: {
name: a.name,
price: a.price,
},
}))
}
})
Incoming request from the iframe to get article info about a list of articles. If subscribed it is expected that a OutMessageArticleInfo is send back per requested article, echoing the requested ArticleIdentifier in the
articlefield so the widget can correlate the response.