London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Try with the below code:
Inject the IContentLoader dependency on constructor level e.g. private readonly IContentLoader _contentLoader;
var contentLinks = block?.ProductContentArea?.FilteredItems?.Select(x => x.ContentLink).ToList();
if (contentLinks != null && contentLinks.Any())
{
var productContentPages = new List<ProductContentPage>();
foreach (var contentLink in contentLinks)
{
if (_contentLoader.TryGet(contentLink, out ProductContentPage productContentPage))
{
productContentPages.Add(productContentPage);
}
}
}
Hi sanjay,
Thanks for the reply, But could you please elaborate it a little more.
I mean i am little confuse with "block" and "ProductContentPage" keywords here.
Hi all,
how to extract the properties of a product present in content area of a page using code?