Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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?