Custom Promotion Types

 

 

Use existing building blocks to construct new 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. A sample promotion XML is given in sample promotion XML. All promotion XML files must follow the document type definition (DTD) given in promotion DTD. In the DTD, the definitions of two XML elements: Filter and Adjustment, are marked as "ANY", which means there is no restriction as to how these should appear. This is because of the high probability that these two elements will require customization. There is a default set of filters and adjustments. Samples of the XML elements for the default filters and adjustments are listed in sample filter XML fragments and sample adjustment XML fragments.

The database table that is used to store promotions is
PX_PROMOTION . In the table definition, note that the XMLPARAM column saves a complete copy of the XML document for the promotion definition. The other fields hold values for most of the promotion's basic attributes. There are a number of other tables used to integrate promotions with WebSphere Commerce. The database tables are introduced in raising customer awareness of promotions.

In addition to PX_PROMOTION table, two more tables have to be populated to integrate a promotion with WebSphere Commerce:
CALCODE and
CLCDPROMO . CLCDPROMO is a relationship table that links all current promotions (promotions whose status is not obsolete) with an entry in the CALCODE table. In addition to the column definition information in the CALCODE table definition, there are some additional promotion-specific details about how the CALCODE table and its related tables are used by the promotions system. Here is the default values for promotion entries in the CALCODE table:

Column Name Column Type Values for This Column
CALCODE_ID INTEGER
NOT NULL
Generated unique identifier.
CODE CHARACTER (128)
NOT NULL
For entries related to promotion, this column holds the name of the promotion.
CALUSAGE_ID INTEGER
NOT NULL
Always "-1", which is the id for CALUSAGE "discount".
STOREENT_ID INTEGER
NOT NULL
The CalculationCode is part of this StoreEntity.
GROUPBY INTEGER
NOT NULL, DEFAULT 0
Always "0".
TXCDCLASS_ID INTEGER
NULL
Null.
PUBLISHED INTEGER
NOT NULL, DEFAULT 0
0, if promotion is not active

1, if promotion is active 2, if promotion has been marked for deletion.

SEQUENCE DOUBLE
NOT NULL, DEFAULT 0
Always "0".
COMBINATION INTEGER
NULL
Always "2".
LASTUPDATE TIMESTAMP
NULL
The time this CalculationCode (and its corresponding promotion) was most recently updated.
CALMETHOD_ID INTEGER
NOT NULL
This references an entry in the CALMETHOD table created for calculating promotions. (If you use Commerce bootstrap as is, you can set this to -3)
CALMETHOD_ID_APP INTEGER
NOT NULL
This references an entry in the CALMETHOD table created for applying promotions (If you use Commerce bootstrap as is, you can set this to -4)
CALMETHOD_ID_QFY INTEGER
NOT NULL
This references an entry in the CALMETHOD table created for qualifying promotions (if you use Commerce bootstrap as is, you can set this to -2)
FIELD1 VARCHAR (254)
NULL
Null.
DESCRIPTION VARCHAR (254)
NULL
Administrative description of a promotion.
DISPLAYLEVEL INTEGER
NOT NULL, DEFAULT 0
0: for promotions target order items

1: for promotions target the entire order

STARTDATE TIMESTAMP
NULL
The start date of the promotion.
ENDDATE TIMESTAMP
NULL
The end date of the promotion.
FLAGS INTEGER
NOT NULL, DEFAULT 0
Always 0.
PRECEDENCE DOUBLE
NOT NULL, DEFAULT 0
Always 0.

The WebSphere Commerce Accelerator supports the creation of almost twenty different promotion types. If your custom promotion type falls outside this set of promotion types, but can be expressed using a different permutation of the existing building blocks, your custom authoring tool will have to build the XML documents, and save them into the tables.

 

Introducing new building blocks

If the existing building blocks do not provide the tools to build your promotion types, you may introduce new building blocks. The XMLizable based component model discussed in promotions customization serves as the basis for any customization that will be discussed in this section. The most common custom building blocks are filters, adjustments, and conditions. However, you can replace the promotion with a custom implementation if necessary. The following sections examine the building blocks:

Related concepts