November Happy Hour will be moved to Thursday December 5th.

Show applied promotions info for current cart

Vote:
 

Hi there

I'm just getting started with the new Promotions API and am trying to simply display the description of the applied promotions for the current cart.

The discounts are affecting the totals but I just can't seem to find the promotion info for what have caused the discount. I can't find this info in the debugger on the ICart object, so probably am meant to get this another way. (Perhaps this is really obvious as I cannot find any info around of how to do it?).

FYI I'm using Epi Commerce v11.2.5

Matt

#183536
Oct 17, 2017 8:23
Vote:
 

Realise I should mention that my EntryPromotionProcessor implementation of Evaluate is returning a RewardDescription with the description I want to show. I just am wanting to find the promotion description on the cart object and easily then display this to the user so they know what promotion they've qualified for.

#183537
Oct 17, 2017 8:30
Vote:
 

You have your applied promotions on the OrderForm. So you could do 

PromotionInformation[] appliedPromotions = orderForms.SelectMany(x => x.Promotions);

and the promotionInformation should have the info you need!

http://world.episerver.com/documentation/class-library/?documentId=commerce/9/CF50C14F

#183538
Oct 17, 2017 8:37
Vote:
 

Thanks Joel! (didn't expect a reply so soon too!)

Can confirm your suggestion works exactly as I needed. Both of these lines work for my ICart:

var promotions = cart.GetFirstForm().Promotions;
var promotions2 = cart.Forms.SelectMany(x => x.Promotions);

Appreciate the guidance!

Matt

#183539
Oct 17, 2017 8:47
Vote:
 

I blame the slow RSS feed for more than 5 minutes delayed answer! :D

#183540
Oct 17, 2017 8:49
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.