Develop > Presentation layer > Customize promotions > Promotions customization: WebSphere Commerce Accelerator
Overview of implementing a new low-level promotion element
You can perform a more complex customization of the promotion engine by creating new promotion elements. For example, you might want to create a new adjustment element to assign a new reward type to qualifying orders.
To create a new low level promotion element, there are 5 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 of the new element and build it. Refer to the promotionXML example. This promotion XML sample explains the usage of the major XML nodes in one promotion. In addition, the Add support for a custom promotion type example further explains some of the options available in terms of replacing or customizing the existing nodes.
Once you understand the XML representation of a the new promotion element;
- If possible, find a similar promotion element from the default elements.
- Create the new promotion element.
- Retrieve the necessary XML from the database.
- Replace the node with the own element.
- Manually create the custom promotion type in the database.
- Test the custom promotion.
- Understand where the promotion is persisted and cached. Promotion data is mainly stored in the PX_PROMOTION table. Refer to storing custom promotion XML in the database for details about how and where to store the promotion's XML representation.
To test a new promotion XML for the customization type, refer to custom promotion types.
- Create any necessary custom Java code for the new element. This code at the very least will have to manage changing the element to XML and back to strings that are readable in the user interface. You should create the class so that it extends XMLizable. This will inherit some useful methods for converting the promotion element to XML and back. You will also need to provide methods that handle the element's behavior.
- 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.