Creating the object template for the new promotion type
Create an object template to define the object structure for the custom promotion type. All promotions defined in the Promotions tool use the same primary object definition. The purpose of the object template is to model the differences between the promotion types. There is one object template for each promotion type. The object template contains all the objects that each promotion type requires.
Before you begin
About this task
- Whether the promotion is an order-level, category-level, or catalog-entry-level promotion
- Whether the discount is a fixed price, a percentage off, an amount off, or a free gift
Create an object template to define the unique properties for your custom promotion type.
Procedure
Example
For your custom promotion type, Customers who purchase two dining chairs (FULO-01) qualify to purchase a dining table (FULO-02) at the reduced price of $200, the object template looks like the following sample:
<library>
<class name="proProductLevelPWPFixedCostDiscountTemplate" 1
extends="wcfObjectTemplate"
templateType="ProductLevelPWPFixedCostDiscount" 2
displayName="Buy X get Y at a fixed cost"
description="Offers a fixed cost discount on a catalog entry when the order includes some other specified catalog entry">
<dataset name="template">
<object objectType="ProductLevelPWPFixedCostPurchaseCondition"> 3
<object objectType="Purchase"/> 4a
<object objectType="Reward"/> 4b
</object>
</dataset>
</class>
</library>
<Definitions>
<ObjectTemplate definitionName="proProductLevelPWPFixedCostDiscountTemplate" 1
templateType="ProductLevelPWPFixedCostDiscount" 2
displayName="Buy X get Y at a fixed cost"
description="Offers a fixed cost discount on a catalog entry when the order includes some other specified catalog entry">
<Xml name="template">
<object objectType="ProductLevelPWPFixedCostPurchaseCondition"> 3
<object objectType="Purchase"/> 4a
<object objectType="Reward"/> 4b
</object>
</Xml>
</ObjectTemplate>
</Definitions>
The following describes the lines
with black numbered callouts:
- 1 This is a unique name you define
for this:
- template class
- template definition
- 2 This is the name you defined for this custom promotion type in the task Modeling the runtime promotion XML.
- 3 This is the name of the purchase condition object definition you defined in the task Creating the object definitions for the new promotion type.
- 4a,b You can add additional code to instantiate additional objects to be used for your user interface.
In this example:
- The code to instantiate this new template
to the promotion primary object definition file looks like this:
<class name="proBasePromotionPrimaryObjectDefinition" extends="wcfPrimaryObjectDefinition" isBaseDefinition="true" objectType="BasePromotion" . . .> . . <proProductLevelPWPFixedCostDiscountTemplate/> . . </class>
- The code to add this new template to the
promotion primary object definition file looks like this:
<PrimaryObjectDefinition definitionName="proBasePromotionPrimaryObjectDefinition" isBaseDefinition="true"...> . . . <ObjectTemplate baseDefinitionName="proProductLevelPWPFixedCostDiscountTemplate"/> . . </PrimaryObjectDefinition>