Next >Tutorial: Creating a promotion type
We 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 our 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 provided with WebSphere 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 we create a custom promotion type using the techniques that are described in this tutorial, our 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, we 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 related to this tutorial.
Skill level
This tutorial is intended for intermediate WebSphere Commerce developers that are responsible for customizing the promotions tool in the WebSphere Commerce instance. To complete this tutorial, you should be familiar with the following terms and concepts:
- WebSphere Commerce promotions.
- The Java programming language
- The XML programming language, including XSL Transformations (XSLT)
System requirements
Before starting this tutorial, ensure that the following tasks are completed:
Tutorial resources
We can download the completed tutorial code for this tutorial for our reference:However, it is recommended that you perform the tutorial to fully obtain the learning objectives.
Lessons in this tutorial
- Modeling the runtime promotion XML for the new promotion type
In this lesson, you learn about how to model the runtime promotion XML for a new promotion type titled "Spend $ on catalog entry X, get catalog entry Y free." During the shopping flow, the promotion engine parses and processes the runtime promotion XML to evaluate whether a shopper qualifies for a promotion.- Planning the user interface customization
In this lesson, you plan which parts of the Management Center user interface you need to customize to support your new promotion type.- Creating new resource bundles for custom text strings
In this lesson, you create a new properties file and resource bundle to define the custom text strings to display on the Management Center user interface for our customized widgets. In the Management Center, all text labels and images displayed in the user interface must be defined as properties and registered in a resource bundles file.- Creating the child object definition for the new promotion type
In this lesson, you define a new child object definition to represent the new purchase condition promotion element.- Creating the object template
In this lesson, you create an object template to define the object structure for the promotion. The object template contains all the objects that each promotion type requires. There is one object template for each promotion type defined in the Promotions tool to specify the unique properties of the promotion type.- Creating the gift reward list view definition for the user interface
In this lesson, you create the Management Center user interface element in which business users specify the free gift and quantity information for the promotion.- Creating the promotion properties view for the user interface
In this lesson, you create a definition file that defines the user interface components that business users use when they create a promotion using the Management Center. These components include the customized gift reward grid you created in the previous lesson.- Adding the new promotion type to the Promotion Type Selector
In this lesson, you add your new promotion type to the Free gift promotions folder in the Promotion Type Selector so business users can select the template when starting a new promotion.- Registering a serialization JSP file
In this lesson, you register a serialization JSP file. This file takes the promotion authoring elements from the PX_ELEMENT and PX_ELEMENTNVP tables and displays them in the "Purchase Condition and Reward" section of the Management Center user interface for our new promotion type. Business users can then use this section of the user interface when they create promotions.- Creating and registering the XSL template
In this lesson, you retrieve an XSL template for the new promotion type and learn about its structure. You then register it as a new promotion rule. The purpose of the XSL template is to transform the authoring promotion XML into the runtime promotion XML. This transformation takes place when a promotion based on this promotion type is activated in the Management Center.- Testing the new promotion type in the Management Center
In this lesson, you create a promotion in the Management Center using our customized promotion code.- Testing the new promotion type in the storefront
In this lesson, you test your new promotion type as a shopper in your Aurora starter store by making a purchase that qualifies you for the free gifts.