Tutorial: Creating a promotion type

You can customize the Management Center Promotions tool to add support for a new promotion type. For instance, if the default promotion types do not meet your business needs. In this tutorial, you create a promotion type by customizing an existing promotion type. The new promotion type is then available in the Promotions tool for your business users to use to create promotions.

A promotion type is a template for creating a promotion with a specific purchase condition and reward. A customer order must meet the purchase condition that is defined in the promotion to qualify for the reward. For example, two common promotion types that are provided with HCL Commerce are Percentage off an order , and Buy catalog entry X, get catalog entry Y free. In the Promotions tool, business users can choose a promotion type as a starting point for their promotion and then enter the details.

If you create a custom promotion type by using the techniques that are described in this tutorial, your custom promotion type is available to business users in Management Center to use as a starting point. For more information about the existing promotion types and their features, see Promotions.

Business users create promotions for the storefront by choosing a promotion type from the Promotions tool and then entering in details about the specific promotion. For example, business users can choose the "Percentage off catalog entry X" promotion type to create a promotion for "20% off the Brewmaster Deluxe Coffeemaker." The Promotions tool is shipped with 21 promotion types. If these existing promotion types do not meet your business needs, you can create a promotion type through customization.

In this tutorial, you create a promotion type titled "Spend $ on catalog entry X, get catalog entry Y free." You base this promotion type on the existing promotion type titled Buy catalog entry X, get catalog entry Y free, but you create a different purchase condition. Additionally, you modify the reward to allow free gift Y to be multiple (different) catalog entries.

Comparison of the existing promotion type to the new promotion type
Promotion type Purchase condition Reward Example
Existing: Buy catalog entry X, get catalog entry Y free The count of catalog entry X must exceed a certain number (one or more). Free gift Y is limited to a single catalog entry. Buy a 5–piece dinnerware set and receive a set of table glasses free!
New:Spend $ on catalog entry X, get catalog entry Y free The total cost of catalog entry X must exceed a certain amount. Free gift Y can be multiple (different) catalog entries. "Spend $100 or more on KitcheCraft Chef Line Knife Set, and receive a Vienna glass free!"

Learning objectives

After completing this tutorial, you should be familiar with the following concepts:

  • Identify the user input necessary to create a promotion type and define a business object to represent the information
  • Define a resource bundle for custom text strings
  • Define a promotion template
  • Use existing Management Center user interface widgets to build a properties view
  • Create and register an XSL template to create the runtime promotion XML
After completing this tutorial, you should be able to perform the following tasks:
  • Customize the Management Center user interface to add the required widgets to the Promotions tool property editor. Customization allows the business user to create promotions by using your new promotion type
  • Customize the promotion engine to add support for the new promotion type

Time required

Expect this tutorial to take 4 hours to complete. The tutorial takes longer if you explore concepts that are related to this tutorial.

Skill level

This tutorial is intended for intermediate HCL Commerce developers that are responsible for customizing the promotions tool in your HCL Commerce instance. To complete this tutorial, you should be familiar with the following terms and concepts:
  • HCL Commerce promotions.
  • The Java programming language
  • The XML programming language, including XSL Transformations (XSLT)

System requirements

Before you begin this tutorial, ensure that the following tasks are completed:

Tutorial resources

You can download the completed tutorial code for this tutorial for your reference:However, it is recommended that you perform the tutorial to fully obtain the learning objectives.