How to handle multiple reward conditions on custom promotion in Episerver 10



I have a scenario where i need to create a promotion that offers multiple rewards like different percent doscount on different products. For example, the condition will be if you buy ProductA, you can get the following rewards : 10 % off on ProductB, 15% off on ProductC and 25% off on ProductD. And i need to run this under same promotion code. Now, i was able to create a custom promotion that reflects this, but at the Processor end, i'm unable to evaluate all 3 rewards to their respective products. The individual reward description can be calculated, but not combined for final result :

 //custom added code to get all rewards
            RewardDescription reward1;
            RewardDescription reward2;
            RewardDescription reward3;

            if (promotion.Reward1.Discount > 0) // check if reward1 was set
                reward1 = RewardDescription.CreatePercentageReward(status, list, promotion,
                                    promotion.Reward1.Discount, rewardDescriptionText);

            if (promotion.Reward2.Discount > 0) // check if reward2 was set
                reward2 = RewardDescription.CreatePercentageReward(status, list, promotion,
                                    promotion.Reward2.Discount, rewardDescriptionText);
            if (promotion.Reward3.Discount > 0) // check if reward3 was set
                reward3 = RewardDescription.CreatePercentageReward(status, list, promotion,
                                    promotion.Reward3.Discount, rewardDescriptionText);

I can't return all 3 rewards here, asthe Evaluate method only returns one RewardDescription object. Also, the affectedEntries are calculating all reward targets together, instead of one for each type. So in the end when i apply one of the rewards, it ends up applying on all 3 products, instead of just one for which it was meant. How can this situation be handled?

And my custom promotion processor wasn't able to handle the scenario where if I remove the ProductA from cart, all associated discounts on other products go away. They didn't.

Please advice.

Nov 27, 2017 22:54


We had just another thread asking for this. Unfortunately we didn't come up with an answer, but you can always poke the thread to see if Giedrius came up with a workaround.

Nov 28, 2017 1:19

Thanks Joel! That link was helpful to some extent. I tried the logic and it works, but not accurately. I need more assisitance. Please respond to my queries on the other thread.

Edited, Nov 28, 2017 15: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.