Develop > Presentation layer > Customize promotions > Promotions customization: Management Center > Create a custom promotion type in the Management Center
Model the runtime promotion XML
Model the runtime promotion XML so that you can identify the data that must be managed through the Management Center user interface for the custom promotion type. The information you gather from this task is used in subsequent promotion customization tasks.
Before you begin
Review the following topics to ensure that you understand how a promotion is represented in XML:
To model the runtime promotion XML for the custom promotion type, start with the runtime promotion XML generated for a similar promotion type. Then analyze the XML to determine how the custom promotion type is different and make any necessary changes to the XML.
Most customized promotion types focus on customizing the <PurchaseCondition> element. The purchase condition defines what customers must have in their shopping cart before they qualify for a promotion, as well as the reward. Business users enter data for a specific promotion in the Purchase Condition and Reward section of the user interface.
Procedure
- To understand the XML representation of a promotion, also known as the runtime promotion XML, read the reference information specified at the beginning of this topic.
- Examine the runtime promotion XML for a similar promotion type to use as a starting point for the model.
You can extract the runtime promotion XML for an existing promotion from your own database. The runtime promotion XML is stored in the PX_PROMOTION database in the XMLPARAM column. Make sure you choose a promotion that is already activated. Until a promotion created in the Management Center is activated, only placeholder XML is stored in the XMLPARAM column; it is displayed as PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.AlwaysFalsePurchaseCondition".
- Make changes to the runtime promotion XML so that it reflects your custom promotion type.
If you are customizing the purchase condition or reward, then the focus is the <PurchaseCondition> element, specifically the <Pattern> element for the purchase condition and the <Distribution> element for the promotion reward.
In some cases, it makes sense to look at more than one default promotion type to get the result you want. Your custom promotion type might combine a purchase condition from one default promotion type with a reward from a different default promotion type.
- Give this promotion structure a unique promotion type name, for example, ProductLevelPWPFixedCostDiscount. Refer to this name later on when creating the custom promotion type.
Example
You want to model the runtime promotion XML for the custom promotion type for the promotion Customers who purchase two dining chairs (FULO-01) qualify to purchase a dining table (FULO-02) at the reduced price of $200. In this case, customize only the contents of the <PurchaseCondition> element in the runtime promotion XML for the new promotion type because all other elements of the promotion type are the same as the default promotion you are using as a starting point, that is, Buy catalog entry X, get a percentage off catalog entry Y.Your model of the <PurchaseCondition> element in the runtime promotion XML looks like the following sample:
<PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.PurchaseCondition"> <Pattern impl="com.ibm.commerce.marketing.promotion.condition.Pattern"> <Constraint impl="com.ibm.commerce.marketing.promotion.condition.Constraint"> <WeightedRange impl="com.ibm.commerce.marketing.promotion.condition.WeightedRange"> <LowerBound>2</LowerBound> <UpperBound>2</UpperBound> <Weight>1</Weight> </WeightedRange> <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain"> <Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter"> <IncludeCatEntryKey> <CatalogEntryKey> <SKU>FULO-01</SKU> <DN>ou=b2c,o=seller organization,o=root organization</DN> </CatalogEntryKey> </IncludeCatEntryKey> </Filter> </FilterChain> </Constraint> <Constraint impl="com.ibm.commerce.marketing.promotion.condition.Constraint"> <WeightedRange impl="com.ibm.commerce.marketing.promotion.condition.WeightedRange"> <LowerBound>1</LowerBound> <UpperBound>1</UpperBound> <Weight>1</Weight> </WeightedRange> <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain"> <Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter"> <IncludeCatEntryKey> <CatalogEntryKey> <SKU>FULO-02</SKU> <DN>ou=b2c,o=seller organization,o=root organization</DN> </CatalogEntryKey> </IncludeCatEntryKey> </Filter> </FilterChain> </Constraint> </Pattern> <Distribution impl="com.ibm.commerce.marketing.promotion.reward.Distribution"> <Type>Volume</Type> <Base>Quantity</Base> <Currency>USD</Currency> <Range impl="com.ibm.commerce.marketing.promotion.reward.DistributionRange"> <UpperBound>-1</UpperBound> <LowerBound>1</LowerBound> <UpperBoundIncluded>false</UpperBoundIncluded> <LowerBoundIncluded>true</LowerBoundIncluded> <RewardChoice> <Reward impl="com.ibm.commerce.marketing.promotion.reward.DefaultReward"> <AdjustmentFunction impl="com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction"> <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain"> <Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter"> <IncludeCatEntryKey> <CatalogEntryKey> <SKU>FULO-02</SKU> <DN>ou=b2c,o=seller organization,o=root organization</DN> </CatalogEntryKey> </IncludeCatEntryKey> </Filter> </FilterChain> <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedCostAdjustment"> <FixedCost>200</FixedCost > <Currency>USD</Currency> <AdjustmentType>IndividualAffectedItems</AdjustmentType> </Adjustment> </AdjustmentFunction> </Reward> </RewardChoice> </Range> <PatternFilter impl="com.ibm.commerce.marketing.promotion.condition.DummyPatternFilter" /> </Distribution> </PurchaseCondition>
Previous topic: Determine the kind of promotion type the store requires
Next topic: Identify the business user input for the new promotion type