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 your customization. This can save a lot of time compared with implementing something entirely new.

About this task

To create a new promotion type, there are 4 high level steps.

Procedure

  1. Determine what kind of promotion your 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 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.
  2. 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;

    1. Identify any similar promotion types among the default promotions.
    2. Retrieve the necessary XML from the database.
    3. Create the new promotion as an XML file.
    4. Combine the nodes as necessary to create your custom condition or reward.
  3. 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:

    1. 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.
    2. Test your custom promotion.
  4. 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 WebSphere Commerce Accelerator, so that it generates XML according to your requirements, refer to Adding support for a custom promotion type as a guideline.