Get PromotionData from the PromotionInformation class

Vote:
 

Hello

A bit of context: I created a custom promotion adding only a new property (Display name) so that I could display a localized text on my order summary. 

Now, when I fetch my promotions applied to my order (order.GetFirstForm().Promotions) I get a list of PromotionInformation

For each PromotionInformation I need to get my new property so that I can display the localized text. I noticed there is an extension EPiServer.Commerce.Marketing.PromotionInformationExtensions.GetPromotion where I can get it, but all methods on this extension are obsolete.

Is there a reason to not use a content loader to get the PromotionData? If so, how could I get my property from a PromotionInformation

(for now I'm using the content loader, I'm jsut curious to know why is it obsolete and if there is a better approach to what I need)

Thanks!

#223698
Edited, Jun 02, 2020 15:58
Vote:
 

Hi Thiago,

As far as I know, the only and best way to get the promotion data from the PromotionInformation list is to content load it. The obsolete extension method you mentioned do exactly this, no more no less. As to why they are obsolete, I can only speculate. 

One pitfall with this is that the promotion behind the reference on the order might be altered or deleted once you content load it. In a utopian world, the promotion data that was applied should be snapshot and stored with the order, but for now only a reference is stored. So keep that in mind when content loading, that they might not be there (especially if you implement something on an order history page, where customers can see old orders).

#223702
Jun 02, 2020 17:04
Vote:
 

Gotcha, it makes totally sense. 

Thank you!

#223703
Jun 02, 2020 17:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.