Promotions
Describes the promotion functionality, which is part of campaign management in Optimizely Commerce Connect.
Classes in this topic are available in the following namespace:
EPiServer.Commerce.Marketing
A promotion is a marketing tool used to increase sales of certain products or product lines. There are three promotion types.
EntryPromotion– Applies reward to a specific entry.OrderPromotion– Applies reward to the entire order.ShippingPromotion– Applies reward to order's shipping cost.
Included item promotions
- Cheapest items for free – Buy at least X items, get the cheapest Y for free.
- Most expensive items for free – Buy at least X items, get the most expensive Y for free.
- Buy products for fixed price – Buy X items from catalog entries for a fixed price.
- Buy products for discount from other selection – Buy at least X items, get a discount on selected items.
- Buy products for discount on all selections – Buy at least X items, get a discount on all.
- Buy products for discount in same category – Get a discount on all items in the selected category.
- Spend for discounted selection – Spend an amount to receive a discount on selected items.
- Spend for free items – Spend an amount to receive gift items.
Included order promotions
- Spend for discount on order – Spend an amount to receive a discount on the total order value.
- Buy products and get discount on order – Buy at least X items, get a discount on the total order value.
Included shipping promotions
- Spend for discount on shipping cost – Spend an amount to get a discount on shipping cost.
- Buy products for discount on shipping cost – Buy at least X items to get a discount on shipping cost.
- Buy products for free shipping – Buy at least X items and get free shipping.
- Spend for free shipping – Spend an amount to get free shipping.
If an order has several shipments, the shipping discount applies only to the shipment with the highest shipping cost.
For example, Shipment 1 has a shipping cost of $39.76 and Shipment 2 in the same order form has a shipping cost of $28.00. If you apply a 10% discount, the discount amount is $3.98.
Extend promotions example
You may want to add properties to promotions for marketing purposes while using the base processor for evaluation.
The following example extends the BuyQuantityGetItemDiscount promotion with an OtherInfo property:
using EPiServer.Commerce.Marketing;
using EPiServer.Commerce.Marketing.Promotions;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace EPiServer.Commerce.Sample.Models.Discounts {
[ContentType(GUID = "530a7f07-8d12-4625-bda3-8e135a10b74d")]
[AvailableContentTypes(Include = new [] {
typeof (PromotionData)
})]
public class MyCompanyBuyQuantityGetItemDiscount: BuyQuantityGetItemDiscount {
[Display(Order = 13, GroupName = SystemTabNames.PageHeader, Prompt = "Other Info")]
public virtual string OtherInfo {
get;
set;
}
}
}Use render templates
Promotion content uses normal rendering templates. By default, only partial views are available for promotion content.
The following example defines a partial controller for the custom promotion:
using System.Web.Mvc;
using EPiServer.Framework.DataAnnotations;
using EPiServer.Web.Mvc;
namespace MyOptimizelySite.Controllers {
[TemplateDescriptor(Default = true)]
public class MyCompanyBuyQuantityGetItemDiscountPartialController: PartialContentController<MyCompanyBuyQuantityGetItemDiscount> {
public ActionResult Index(MyCompanyBuyQuantityGetItemDiscount currentDiscount) {
// Implementation of action view the page.
return View(currentDiscount);
}
}
}The following example shows the rendering view for the promotion partial view:
@using EPiServer.Core
@using EPiServer.Web.Mvc.Html
@model EPiServer.Commerce.Sample.Models.Discounts.MyCompanyBuyQuantityGetItemDiscount
<h1>
@Html.DisplayFor(m => m.Name)
</h1>
<h3>
@Html.PropertyFor(m => m.Description)
</h3>
<p>
@Html.PropertyFor(m => m.OtherInfo)
</p>Related blog post: Old promotion system is (already) dead, long live the new promotion system
Updated 21 days ago
