K Khan
Mar 31, 2016
  1643
(1 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
Plug-in manager is back in CMS 12

Plug-in manager is back in the UI, what is it and how can i use it?

Luc Gosso (MVP) | Oct 6, 2022 | Syndicated blog

Display Child Pages in Content Delivery API Response

The below example will implement an instance of IContentConverterProvider to customise the serialisation of PageData and output child pages in the...

Minesh Shah (Netcel) | Oct 4, 2022

Bring the Report Center back in Optimizely CMS 12

The Report Center has been a part of Optimizely CMS since its first debut in version 5R2 in 2008, but in CMS 12, it's removed! Don't despair! Make...

Tomas Hensrud Gulla | Oct 4, 2022 | Syndicated blog

Customizing Property Lists in Optimizely CMS

Generic property lists is a cool editorial feature that has gained a lot of popularity - in spite of still being unsupported (officially). But if y...

Allan Thraen | Oct 2, 2022 | Syndicated blog