World is now on Opti ID! Learn more

KhurramKhang
Mar 31, 2016
  804
(0 votes)

Promotions That Drive Customer Engagement - Part2

A successful online promotional campaign is depending on 3 vital steps i.e.

Effective promotional strategy
Segmenting and targeting your clients
Evaluating promotions and correcting them

A successful promotional campaign requires a well though strategy to target every potential customer. For the best results businesses targets specific offers to the right people at the right time. At the same time evaluating your promotional campaigns, including client’s behaviour, profit margins or desired customer engagement can make a huge impact. Introducing user specific coupon codes is one of the ways to achive this.

Businesses usually have to find the best Ecommerce solution that fits with their business requirements and have to rely on that with very less customization. EPiServer’s new promotion system is potentially able to resolve any complex promotion scenarios that a business will be looking to achieve their business goals and can fit with any promotional model. 

How promotion system overall works?

Image custompromotions.PNG

Promotion Data (inherit EntryPromotion, OrderPromotion or ShippingPromotion): This is the model that makes up the promotion. In our case this is the visitor group we need to match and the discount percentage to apply to the order

Promotion Processor (inherit PromotionProcessorBase<T>): This processor evaluates eligibility for the promotions and returns an instance of IPromotionResult Promotion Result (implements IPromotionResult) This is returned by our processor and does the work of applying the promotion

Promotion Engine (inherit EPiServer.Commerce.Marketing.PromotionEngine): Evaluates the condition on all active promotions and gives reward to specific orders when the conditions are fulfilled.

New promotion system is capable to handle most complex promotion situations also even if those are not available out of the box. As even we can create our own custom promotion engine also if existing one is not fitting well with the current business.

How to create a custom promotion?

Best example so far is, http://www.david-tec.com/2015/07/creating-a-custom-promotion-with-the-new-episerver-commerce-9-promotion-engine-beta---part-1

How to create a custom promotion engine? *

You will require to implement a CustomPromotionEngine Class Inherited from EPiServer.Commerce.Marketing.PromotionEngine and register your CustomPromotionEngine for IPromotionEngine at site initialization

public class CustomPromotionEngine : EPiServer.Commerce.Marketing.PromotionEngine
    {

        public CustomPromotionEngine(EPiServer.Commerce.Marketing.PromotionProcessorResolver promotionProcessorResolver, 
            IContentLoader contentLoader,
            EPiServer.Commerce.Marketing.CampaignInfoExtractor campaignInfoExtractor,
            EPiServer.Commerce.Marketing.RewardApplicatorResolver rewardApplicator,
            EPiServer.Commerce.Marketing.IAdditionalPromotionInformationCreator additionalPromotionInformationCreator,
            EPiServer.Commerce.Marketing.ICouponFilter couponFilter, 
            ReferenceConverter referenceConverter) :
            base(promotionProcessorResolver, contentLoader, campaignInfoExtractor, rewardApplicator, additionalPromotionInformationCreator, couponFilter, referenceConverter)
        {
        }

        public override IEnumerable<RewardDescription> Run(Mediachase.Commerce.Orders.IOrderGroup orderGroup)
        {
        }
    }

How to add a coupon code into cart? *

Coupon codes stored via MarketingContext.Current.AddCouponToMarketingContext will not be processed via promotion engines. Instead, IOrderForm have a new property CouponCodes that can be used to record all the coupon codes applied on order. Promotion engine will process the IOrderForm.CouponCodes e.g.

(CartHelper.Cart.OrderForms[0] as IOrderForm).CouponCodes.Add("CoupoCode");

How to evaluate your coupon usage for reporting?

public class CustomCouponUsage : ICouponUsage
{
    public void Report(IEnumerable<PromotionInformation> appliedPromotions)
    {
        foreach (var promotion in appliedPromotions)
        {
            var code = promotion.CouponCode;
            //RedeemCouponCode class is a DDS based class to store entries for used coupons
            RedeemCouponCode red = new RedeemCouponCode();
            red.Color = "Red";
            red.CouponCode = code;            
            red.Redeem();
        }
    }
}

* It is tested on EPiServer Commerce 9.10.0, It may be different on older versions, This area is subject to change as is available in Beta mode.

Please note, this post is part of my research on new promotion systems and is not based on real time implementation, Feel free to discuss if you find something is dodgy.

Part 1

Part 3: Working Custom Promotion Engine, Record used coupons [In Progress]

Mar 31, 2016

Comments

Please login to comment.
Latest blogs
Make Global Assets Site- and Language-Aware at Indexing Time

I had a support case the other day with a question around search on global assets on a multisite. This is the result of that investigation. This co...

dada | Jun 26, 2025

The remote server returned an error: (400) Bad Request – when configuring Azure Storage for an older Optimizely CMS site

How to fix a strange issue that occurred when I moved editor-uploaded files for some old Optimizely CMS 11 solutions to Azure Storage.

Tomas Hensrud Gulla | Jun 26, 2025 |

Enable Opal AI for your Optimizely products

Learn how to enable Opal AI, and meet your infinite workforce.

Tomas Hensrud Gulla | Jun 25, 2025 |

Deploying to Optimizely Frontend Hosting: A Practical Guide

Optimizely Frontend Hosting is a cloud-based solution for deploying headless frontend applications - currently supporting only Next.js projects. It...

Szymon Uryga | Jun 25, 2025

World on Opti ID

We're excited to announce that world.optimizely.com is now integrated with Opti ID! What does this mean for you? New Users:  You can now log in wit...

Patrick Lam | Jun 22, 2025

Avoid Scandinavian Letters in File Names in Optimizely CMS

Discover how Scandinavian letters in file names can break media in Optimizely CMS—and learn a simple code fix to automatically sanitize uploads for...

Henning Sjørbotten | Jun 19, 2025 |