Develop > Presentation layer > Customize promotions > Promotions customization: Management Center > Create a custom promotion type in the Management Center


Update the promotion type configuration file

For a custom promotion type, 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 you created and other attributes for the new promotion type in a new promotion type configuration file.


Procedure

  1. Navigate to the following directory:

    WC_EAR/xml/config

  2. Create a com.ibm.commerce.promotion-ext directory.

  3. Create a new 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 with the differences from the previous example indicated in bold text. Here, the promotion type configuration file indicates that a new "MyOrderLevelPercentDiscount" promotion type uses the "MyOrderLevelPercentDiscountPurchaseConditionTemplate.xsl" template to perform the transformation for purchase conditions; other promotion elements, for example, the <CustomConditions> and <TargetingCondition> elements, will 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 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 the 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 full custom promotion type configuration file looks like this:

<?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>


What to do next

After you complete the customization:

  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This is the default environment setting.

  2. Test the changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.

  3. Deploy your changes to the production environment.


Previous topic: Create the XSLT template to transform the promotion XML


+

Search Tips   |   Advanced Search