Developer Documentation

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

  1. You create a gift selection discount using Marketing Manager OR a discounted item selection discount.
  2. You implement an IBasketAdditionSelector and register it with Enticify.
  3. The customer adds items to their basket and meets the promotion condition and eligibility requirements.
  4. We call your IBasketAdditionSelector asking you to select the basket addition.
  5. If the customer has not selected for this promotion before:
    • You record the choices available by looking at the IList<BasketAdditionInfo> and contained LineItemInfos.
    • 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.
  6. If the customer has selected an addition for this promotion:
    • You return BasketAdditionSelected with the selected BasketAdditionInfo 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.
  7. If the customer has declined the this promotion:
    • You return BasketAdditionDeclined.
    • We do not apply this promotion.
    • We continues applying subsequent promotions.

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 implement IBasketAdditionSelection.
  • 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 the Enticify.Promotions.Advanced namespace.

Understanding the IList<BasketAdditionInfo>

  • We call your IBasketAdditionSelector with a list of BasketAdditionInfo.
  • There is one BasketAdditionInfo for each choice.
  • A BasketAdditionInfo is a List<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.