Storing custom promotion XML in the database

Procedure

  1. Open WebSphere Commerce Accelerator.
  2. Click Marketing > Promotions.
  3. Click New.
  4. Create a new Product Promotion leaving most settings as their default values. Fill in only what is required to create the promotion. Everything can be changed except the NAME and DESCRIPTION, when you do the customization.
  5. Activate the new promotion From the Marketing menu, select Promotions. Select the check box beside your new promotion, and click Activate.
  6. Confirm that the new promotion is in the WebSphere Commerce database.
       select px_promotion_id, name from px_promotion where name='NAME_OF_YOUR_NEW_PROMOTION' and status=1 and storeent_id =YOUR_STOREENT_ID
  7. Output the configuration of the promotion to a text file (replace YOUR_PROMOTION_ID with the value you saw in step 6).
    
       select xmlparam from px_promotion where px_promotion_id=
    YOUR_PROMOTION_ID
    > 
         promo_xml.txt
    
  8. Customize the promotion XML text file to work as you require. For more information about how to structure your XML, see the Promotion XML topic.
  9. In a text editor, remove all whitespace and newline characters between XML tags so it the entire XML string is a single line:
    1. Trim trailing spaces.
    2. Trim leading spaces.
    3. Replace newlines with nothing.
    4. Remove extra spaces between tags.
  10. Load this line into the database replacing the xmlparam from the original promotion:
       update px_promotion set xmlparam='<?xml version="1.0" encoding="UTF-8"?> 
         .......</Promotion>' where px_promotion_id=
    YOUR_PROMOTION_ID
    
    
    DB2Note: This update can be troublesome on a db2cmd command line, if the buffer is not large enough. It is much easier to do using the DB2 Command Center.
    You should be able to see your promotion in WebSphere Commerce Accelerator.
    Note: For some customizations made in this manner you will not be able to alter your promotion from WebSphere Commerce Accelerator (the GUI does not support it). To make changes to your promotion conditions and rewards you would need to repeat the preceding steps. See Promotions Customization for more information about how to customize promotions so that they can be edited in the WebSphere Commerce Accelerator.
  11. Deactivate the new promotion.
  12. Activate the new promotion.
  13. Browse the store to see if the pattern of the new promotion is in effect.