Tutorial: Creating a new promotion type
This tutorial shows you how to customize the Management Center Promotions tool to add support for a new promotion type.
Business users create promotions for the storefront by choosing a promotion type from the Promotions tool and then filling in details about the specific promotion. For example, business users could 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 the business needs, you can create a new promotion type through customization.
In this tutorial, you create a new 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 $200 or more on dinnerware and receive a set of table glasses and wine glasses free!
This tutorial covers the tasks you perform to:
- Customize the Management Center user interface, to add the required widgets to the Promotions tool property editor so that the business user can create promotions using the new promotion type
- Customize the promotion engine, to add support for the new promotion type
Learning objectives
After completing this tutorial, you should be able to:
- Identify the user input necessary to create a new promotion type and define an OpenLaszlo object to represent the information
- Define a resource bundle for custom text strings
- Define a promotion template
- Use existing OpenLaszlo user interface widgets to build a properties view
- Create and register an XSL template to create the runtime promotion XML
Time required
Expect this tutorial to take about 4 hours to complete.
You can download the completed tutorial code for this tutorial for the reference:
- Download the completed tutorial code for WebSphere Commerce v7 and Feature Pack 1.
- Download the completed tutorial code for WebSphere Commerce v7 Feature Pack 2.
However, in order to fully attain the learning objectives, it is recommended that you perform the tutorial step by step.
Skill level
Intermediate
Audience
This tutorial is intended for customers who want to extend the Management Center Promotions tool by adding a new promotion type.
System requirements
Before beginning this tutorial, ensure that you have:
- Installed WebSphere Commerce Developer v7
- Created a Marketing Manager user
- Published the Madisons sample store so that you can test the promotion on the storefront
Prerequisites
To complete this tutorial you should have a basic understanding of:
- WebSphere Commerce promotions
- How promotion data is stored and managed
- The Management Center framework
- The promotion engine framework
- WebSphere Commerce Developer
- The Java programming language
- The OpenLaszlo programming language
- The XML programming language, including XSL Transformations (XSLT)
Lessons in this tutorial
- Model 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.
- Plan the user interface customization
In this lesson, you plan which parts of the Management Center user interface customize to support the new promotion type.
- Create 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 the 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.
- Create the child object definition for the new promotion type
In this lesson, you define a new OpenLaszlo child object definition class or a new Management Center child object definition to represent the new purchase condition promotion element.
- Create 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.
- Create the gift reward grid class or 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.
- Create the promotion properties view for the user interface
In this lesson, you create a class or a definition 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.
- Add the new promotion type to the Promotion Type Selector window
In this lesson, you add the new promotion type to the Free gift promotions folder in the Promotion Type Selector window so business users can select the template when starting a new promotion.
- Register 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 the new promotion type. Business users can then use this section of the user interface when they create promotions.
- Create 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.
- Test the new promotion type in the Management Center
In this lesson, you create a promotion in the Management Center using the customized promotion code.
- Test the new promotion type in the storefront
In this lesson, you test the new promotion type as a shopper in the Madisons store by making a purchase that qualifies you for the free gifts.