Overview of creating a new promotion type using existing promotion elements
Add a custom promotion type to HCL Commerce Accelerator by reusing elements of the default promotions to simplify your customization. This can save a lot of time compared with implementing something entirely new.
About this task
Procedure
-
Determine what kind of promotion your store requires.
HCL 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 your requirements against the existing promotion types to determine whether you can reuse elements of the default promotions to simplify your 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 your 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 your 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 your 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.
- Test your custom promotion.
-
Update the user interface as needed.
This step should be done once you have a promotion XML that represents your business logic. To customize the HCL Commerce Accelerator, so that it generates XML according to your requirements, refer to Adding support for a custom promotion type as a guideline.