Basket Addition Selection (2.7+)
This guide covers the development tasks required to support promotions that offer a basket addition selection.
After reading this guide you will understand:
- What a basket addition selection is!
- The basket addition selection process.
- How to write code to select or decline a basket addition.
- How to set properties on the basket addition lines.
What is a Basket Addition?
If a promotion award is the addition of new line items to a customer basket, then it is a basket addition promotion. If there is a choice of basket addition, then we need to make a basket addition selection.
The Basket Addition Selection Process
- You create a gift selection discount using Marketing Manager OR a discounted item selection discount.
- You implement an
IBasketAdditionSelector
and register it with Enticify. - The customer adds items to their basket and meets the promotion condition and eligibility requirements.
- We call your
IBasketAdditionSelector
asking you to select the basket addition. - If the customer has not selected for this promotion before:
- You record the choices available by looking at the
IList<BasketAdditionInfo>
and containedLineItemInfo
s. - You return a
BasketAdditionDeclined
. - We skip this promotion and finish applying any subsequent promotions.
- You ask the customer to select from the list of choices.
- The customer can select an option OR decline the promotion.
- You store their selection for this promotion.
- You run the basket again.
- Go back to step 4.
- You record the choices available by looking at the
- If the customer has selected an addition for this promotion:
- You return
BasketAdditionSelected
with the selectedBasketAdditionInfo
index. - We add the selected
BasketAdditionInfo
line item(s) to the customer basket. - We call your
ILineItemUpdater
so you can set properties on the line.
- You return
- If the customer has declined the this promotion:
- You return
BasketAdditionDeclined
. - We do not apply this promotion.
- We continues applying subsequent promotions.
- You return
Developing an ILineItemUpdater
For ILineItemUpdater
development details, read the Developing an ILineItemUpdater section of the Gift with Purchase guide..
Developing an IBasketAdditionSelector
The Basic Implementation
To implement basket addition selection in code, you write a single class that implements IBasketAdditionSelector
. The steps are as follows:
- Add a reference to
Enticify.CommerceServer.dll
. - Add a new class to your solution (e.g.
MyBasketAdditionSelector
). - Add a using statement for
Enticify.Promotions
. - Add a using statement for
Enticify.Promotions.Basket
. - Make
MyBasketAdditionSelector
implementIBasketAdditionSelection
. - Implement the logic required to carry out the basket addition selection process described in the previous section.
- Call one of the
ExtensionRegistry.ScanAssembliesForExtensions
overloads once in the application on start. This must happen before Enticify runs for the first time. This class is in theEnticify.Promotions.Advanced
namespace.
Understanding the IList<BasketAdditionInfo>
- We call your
IBasketAdditionSelector
with a list ofBasketAdditionInfo
. - There is one
BasketAdditionInfo
for each choice. - A
BasketAdditionInfo
is aList<LineItemInfo>
(as a basket addition could involve more than a single line item). - The
LineItemInfo
instances contain the information you need to show your customer the options. - You select the addition you want by index and provide that to us.
Example
The following code is a skeleton example of an IBasketAdditionSelector
component. The example contains comments that will help you implement your basket addition selector.