Develop > Presentation layer > Customize promotions > Promotion engine customization > Customization scenarios
Overview of creating a new promotion type using existing promotion elements
Add a custom promotion type to WebSphere Commerce Accelerator by reusing elements of the default promotions to simplify the customization. This can save a lot of time compared with implementing something entirely new.
To create a new promotion type, there are 4 high level steps.
Procedure
- Determine what kind of promotion the store requires. WebSphere Commerce provides a rich set of default promotion types, including purchase conditions which apply at either the product level or the order level. The rewards target individual catalog entries, the entire order, or the related shipping charges. An additional default promotion type is called purchase with purchase, in which a customer who purchases some catalog entry gets some other catalog entry at a discount. Comparing the requirements against the existing promotion types to determine whether you can reuse elements of the default promotions to simplify the customization. This can save a lot of time compared with implementing something entirely new.
- Understand the promotion XML presentation and build it.
Refer to the promotionXML example. This promotion XML sample explains the usage of the major XML nodes in one promotion. Most customization scenarios can be achieved by updating the elements under the <PurchaseCondition> node.
The purchase condition contains two key elements: a qualification criteria that is compared to the shopping cart, and a reward that is given to the customer if the qualification criteria is met. This purchase condition, as part of the larger promotion definition, is represented as XML.
To see a sample purchase condition defined using XML, refer to the promotionXML example. Each of the elements is discussed in detail in Purchase condition XML definition.
If the promotion type combines one of the default promotion conditions with a reward from a different default promotion, such as "buy 3 of item A, get free shipping using the express shipping method", which combines an item level purchase condition and a shipping level reward, you can build the own promotion by merging the purchase condition from the "Product Level Percentage Off" promotion type, and the reward from the "Discounted Shipping" promotion.
Once you understand the XML representation of a promotion follow these steps;
- Identify any similar promotion types among the default promotions.
- Retrieve the necessary XML from the database.
- Create the new promotion as an XML file.
- Combine the nodes as necessary to create the custom condition or reward.
- Understand where the promotion is persisted and cached. Promotion data is mainly stored in the PX_PROMOTION table.
To test a new promotion XML for the customization type, refer to custom promotion types.
Now you can perform the next steps:
- Create the promotion definition in the database manually. Refer to storing custom promotion XML in the database for details about how and where to store the promotion's XML representation.
- Test the custom promotion.
- Update the user interface as needed. This step should be done once you have a promotion XML that represents the business logic.
To customize the WebSphere Commerce Accelerator, so that it generates XML according to the requirements, refer to Add support for a custom promotion type as a guideline.
- Store custom promotion XML in the database
- Custom promotion types
The promotion authoring tools included in WebSphere Commerce Accelerator are responsible for building a promotion XML document using all of the building blocks available, and saving the promotion in the promotion persistence storage. This includes any additional data that is needed for integration with the environment in which the promotion executes.
Related reference