Updating the promotion type configuration file

For a custom promotion type, you must identify to the promotion service which XSLT templates to use to transform the authoring promotion XML to the runtime promotion XML. You must also identify which attributes the custom promotion type has. To do this, you register the custom XSLT template that you created and other attributes for the new promotion type in a new promotion type configuration file.

Procedure

  1. Go to the following directory:

    workspace_dir/WC/xml/config

  2. Create a com.ibm.commerce.promotion-ext directory.
  3. Create a promotion type configuration file named com.ibm.commerce.promotion.facade.server.config.PromotionComponentConfigurationImpl.xml.
  4. Register the custom XSLT template and other attributes for the new promotion type in the new promotion type configuration file.

    The default promotion types are registered in promotion type configuration file at this path:

    xml\config\com.ibm.commerce.promotion\com.ibm.commerce.promotion.facade.server.config.PromotionComponentConfigurationImpl.xml

    An entry in the default promotion type configuration file for a default promotion type looks like the following code sample:

    <promotionTypeConfiguration name="OrderLevelPercentDiscount">
       <param key="purchaseConditionTemplate" value="OrderPercentOffPurchaseConditionTemplate.xsl"/>
       <param key="basePromotionTemplate" value="DefaultBasePromotionTemplate.xsl"/>
       <param key="customConditionTemplate" value="DefaultCustomConditionsTemplate.xsl"/>
       <param key="targetingConditionTemplate" value="DefaultTargetingConditionTemplate.xsl"/>
       <param key="promotionGroup" value="OrderLevelPromotion"/>
       <param key="calculationCodeDisplayLevel" value="1"/>
    </promotionTypeConfiguration>

    The following example is a custom promotion type configuration file. Differences from the previous example are indicated in bold text. Here, the promotion type configuration file indicates that a new "MyOrderLevelPercentDiscount" promotion type uses the "MyOrderLevelPercentDiscountPurchaseConditionTemplate.xsl" template to transform for purchase conditions; other promotion elements, for example, the <CustomConditions> and <TargetingCondition> elements, use the default templates.

    <promotionTypeConfiguration name="MyOrderLevelPercentDiscount">
       <param key="purchaseConditionTemplate" value="MyOrderPercentOffPurchaseConditionTemplate.xsl"/>
       <param key="basePromotionTemplate" value="DefaultBasePromotionTemplate.xsl"/>
       <param key="customConditionTemplate" value="DefaultCustomConditionsTemplate.xsl"/>
       <param key="targetingConditionTemplate" value="DefaultTargetingConditionTemplate.xsl"/>
       <param key="promotionGroup" value="OrderLevelPromotion"/>
       <param key="calculationCodeDisplayLevel" value="1"/> 
    </promotionTypeConfiguration>
    The last two parameters serve the following purposes:
    • promotionGroup: This parameter references the promotion group that the promotion type belongs to, that is, order-level, product-level, or shipping
    • calculationCodeDisplayLevel: This parameter defines what customers see on the storefront regarding the promotion price adjustment. The value 0 (order item display level) means a customer sees the adjustment that is broken down for each individual item in their order. The value 1 (order display level) means the customer sees the adjustment for the whole order in a summary.

Example

For your custom promotion type, the full custom promotion type configuration file looks like the following example:
Customers who purchase two dining chairs (FULO-01) qualify to purchase a dining table (FULO-02) at the reduced price of $200
<?xml version="1.0" encoding="UTF-8"?> 
<promotionComponentRegistry>
   <promotionTypeConfiguration name="ProductLevelPWPFixedCostDiscount">
      <param key="purchaseConditionTemplate" value="ProductPurchaseWithPurchaseFixedCostPurchaseConditionTemplate.xsl"/>
      <param key="basePromotionTemplate" value="DefaultBasePromotionTemplate.xsl"/>
      <param key="customConditionTemplate" value="DefaultCustomConditionsTemplate.xsl"/>
      <param key="targetingConditionTemplate" value="DefaultTargetingConditionTemplate.xsl"/>
      <param key="promotionGroup" value="ProductLevelPromotion"/>
      <param key="calculationCodeDisplayLevel" value="0"/>
   </promotionTypeConfiguration>
</promotionComponentRegistry>