Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
You should use the IRelationRepository instead :) See https://world.episerver.com/documentation/developer-guides/commerce/catalogs/catalog-content/Product-variants/
IContentLoader.GetChildren on returns the direct children of the parentLink. I.e. if you have more than 1 level of categories then entries in sub-categories are not returned. Check out https://leanpub.com/epicommercerecipes/read_sample, recipe 1.2
This is my method and I am trying to get all variants by using conent loader. But it doesn't work for me. I am on EpiServer (CMS and Commerce) version 11
private IEnumerable GetChildrenAndRelatedEntries(CatalogContentBase catalogContent)(catalogContent.ContentLink).ToList();
where TEntryContent : EntryContentBase
{
var variantContentItems = this.contentLoader.GetChildren
var variantContainer = catalogContent as IVariantContainer;(variantContainer));
if (variantContainer != null)
{
variantContentItems.AddRange(this.GetRelatedEntries
}
return variantContentItems.Where(e => e.IsAvailableInCurrentMarket(this.currentMarket));
}
Any Idea.