November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi John,
Is it this you're looking for?
ILinksRepository.GetRelationsBySource(new ContentReference(ParentId)).OfType<ProductVariation>().OrderBy(r => r.SortOrder);
PS, this thread should be posted into the commerce forum
Regards
Thanks Gosso,
I will try this out - I'll let you know if it works!
Best,
John
Unless you have a specific reason to load the DTO or Entry objects I would really recommend working with the catalog data as IContent using IContentLoader. IContentLoader.GetItems can be used to batch load content.
BTW, don't use the ID part of the content link as the ID of a low-level catalog entity like an entry or node. To convert between ContentReferences and ID:s for catalog entities, use ReferenceConverter.GetObjectId to make sure the conversion is done correctly.
I moved this thread to Commerce forum
What are you trying to do with the Entry(s)? As Rahl said we recommend to use the content APIs (IContentLoader etc.). Loading an Entry also means loading prices and inventories (even when you don't need them), and an Entry object has a quite poor reuseable so caching is pretty limited.
Hey Guys,
I'm trying to bulk load entries via the GetCatalogEntriesDto so I can access the ItemAttributes of the Entry, does that make sense?
Best,
John
When you load the IContent you can access the properties via Property. Or even better, if you use strongly typed content types, inherited from ProductContent, VariantionContent, etc., you can access the properties in a strong typed maner, so instead of ItemAttributes["AHiddeTypo"], you can make it productContent.AHiddenTypo.
Spot the difference?
Hey Guys,
The IContentLoader solution worked for me!
Thannks for all your help!
Best,
John
Hey Everyone,
Stuck on a little bit of a brain teaser. Currently, I get all product variations via their ContentReference.ID and use this to get an Entry instance in a foreach loop.
I'm trying to optimise code (cut down database calls) so that we bulk load in CataLogEntries as Entry instances (Probably store these in a dictionary or List). I'm hoping to use the the GetCatalogEntriesDto method to load Entry instances before entering the foreach loop and then using LINQ get a particular Entry instance based on ContentReference.ID something like:
Can anyone advise here please?
Best,
John