Example: runtime promotion XML

The runtime promotion XML is the name that is given to the XML representation of a promotion type. The promotion engine uses the runtime promotion XML to evaluate the promotion on the storefront.

This following example code represents a complete XML representation of a promotion, that is, the runtime promotion XML:

<?xml version="1.0" encoding="UTF-8"?>

<!-- This promotion does the following:
    Purchase total between 100 and above, get 15 dollars off.
<Promotion impl="com.ibm.commerce.marketing.promotion.DefaultPromotion">

   <!-- this identifies the promotion.  -->
      <!-- Name of the promotion -->
      <!-- The store which owns this promotion. Store key is defined as the 
         combination of the DN of the organization that owns  this store and a 
         store name -->
         <DN>o=Root Organization</DN>
         <Identifier>BlueStore 201</Identifier>

      <!-- Versions of a promotion. Statistics are associated with the
         version number,promotions with the same promotion key and version 
         number but different revision are considered different revisions of
         the same promotion.  Promotions with the same key but different 
         version numbers are considered distinct promotions. -->

   <!-- Promotions are group by groups, and groups are scoped by store, 
      refer to promotion organization for details on what a group is, its role 
      and the default groups -->

         <DN>o=Root Organization</DN>
         <Identifier>BlueStore 201</Identifier>

   <!-- Various descriptions of the promotion -->
   <TypedNLDescription impl="com.ibm.commerce.marketing.promotion.TypedNLDescription">
      <Description locale="en_US" type="admin">[en_US:admin]A sample promotion</Description>
      <Description locale="en_US" type="long">[en_US:long]A sample promotion</Description>
      <Description locale="en_US" type="short">[en_US:short]A sample promotion</Description>
      <Description locale="fr_FR" type="admin">[fr_FR:admin]A sample promotion</Description>
      <Description locale="fr_FR" type="long">[fr_FR:long]A sample promotion</Description>
      <Description locale="fr_FR" type="short">[fr_FR:short]A sample promotion</Description>

   <!-- Priority of the promotion the higher the more important -->

   <!-- Exclusiveness of the promotion. Possible values are:  
     0: not exclusive at all 
     1: exclusive at the group level 
     2: exclusive at a global level 
     3: a backward compatibility mode that mimics the combinability 
        of order level promotions with product level promotions in 
        previous releases
     4: This promotion can be stacked on top of other promotions in the same promotion group

   <!-- For future use, always empty for now --> 
   <ExemptPolicyList />
   <!-- For future use, always empty for now -->
   <ExplicitlyAppliedPolicyList />

   <!-- Status of the promotion: 
      0: inactive
      1: active
      2: deleted
      3: suspended 
      4: obsolete

   <!-- Audit trail, last update time and last person who updated the 
      promotion -->
   <LastUpdate>01-09-2003 12:00:00</LastUpdate>

   <!-- How many times this promotion can be applied to the current order, 
      possible values are:  
      -1:              unlimited
      positive number: the limit 

   <!-- How many times this promotion can be applied to a shopper, 
      possible values are:  
      -1:              unlimited,
      positive number: the limit 

      This value is only valid for a registered shopper, for none registered 
      shoppers there is no way to control how many times a shopper can redeem a 

   <!-- How many times this promotion can be redeemed overall.
       Possible values are:
       -1:              unlimited,
       positive number: the limit 

   <!-- Schedule information of this promotion -->
   <Schedule impl="com.ibm.commerce.marketing.promotion.schedule.PromotionSchedule">
      <DateRange impl="com.ibm.commerce.marketing.promotion.schedule.DateRangeSchedule">
         <Start inclusive="true">01-09-2003</Start>
         <End inclusive="true">31-12-2004</End>
      <TimeWithinADay impl="com.ibm.commerce.marketing.promotion.schedule.TimeRangeWithinADaySchedule">
         <Start inclusive="true">00:00:00</Start>
         <End inclusive="false">23:59:59</End>
      <Week impl= "com.ibm.commerce.marketing.promotion.schedule.WeekDaySchedule">

   <!-- Type of promotion:
       0: targeted
       1: private, that is, a coupon promotion -->

   <!-- Optional, if default promotion code manager and resolver are used, 
           this is the promotion code for this promotion, if not, this can be 
           left empty or used as cue for promotion code generation 

   <!-- Whether a code is required to redeem this promotion. -->

   <!-- Check the target condition or not -->

   <!-- When a promotion code is entered, should the target condition be checked -->

   <!-- Do not change this element-->
   <PromotionCodeCondition impl= "com.ibm.commerce.marketing.promotion.condition.PromotionCodeCondition" />

   <!-- Targeting condition based on customer segments defined in HCL Commerce -->
   <Targeting impl= "com.ibm.commerce.marketing.promotion.condition.TargetingCondition">
            <OwnerDN>o=Root Organization</OwnerDN>
            <OwnerDN>o=Root Organization</OwnerDN>
            <ProfileName>DINK Couple</ProfileName>
            <OwnerDN>o=Root Organization</OwnerDN>

   <!-- Custom condition can be added here for example:
      <Condition impl= "com.myCompany.condition.custom.MyOtherMoreComplexCondition">
      <!-- Where myCompany is a custom package name. -->

   <CustomConditions />

   <!-- This is core of a promotion definition. It follows the model 
        introduced in appendix B -->
   <PurchaseCondition impl= "com.ibm.commerce.marketing.promotion.condition.PurchaseCondition">
      <!-- Matches the pattern targeted by the current promotion: the following 
          pattern matches the entire order, for details refer to the promotion 
          purchase condition model document -->
      <Pattern impl="com.ibm.commerce.marketing.promotion.condition.Pattern">
         <!-- A pattern is made up of multiple constraint, each specifying a 
             list of items that make up part of the pattern. There must be no 
             cross-sections between constraints -->
         <Constraint impl= "com.ibm.commerce.marketing.promotion.condition.Constraint">
            <!-- Quantity requirement of this constraint -->
            <WeightedRange impl= "com.ibm.commerce.marketing.promotion.condition.WeightedRange">
               <!-- minimum number of item is 1 --> 
               <!-- Maximum number of item is not limited -->
               <!-- Match as many as items that satisfy the criteria defined in 
                    the filter chain next -->

            <!-- Selection criteria -->
            <FilterChain impl= "com.ibm.commerce.marketing.promotion.condition.FilterChain">
               <!-- Multiple filters can be specified, the are applied in a 
                    contiguous fashion, that is, connected using a logical "and". -->
               <!-- The dummy filter returns anything passed to it, it 
                    effectively selects anything -->
               <Filter impl= "com.ibm.commerce.marketing.promotion.condition.DummyFilter" />

            <!-- The combination of the quantity requirement and the filter 
                  chain would return everything present in the shopcart as one big 
                  matched pattern -->

      <!-- Once pattern is matched, rewards are assigned, for details refer to the 
          purchase condition model document -->

      <Distribution impl= "com.ibm.commerce.marketing.promotion.reward.Distribution">

         <!-- A volume based distribution on the spending total is performed, 
                spending total is measure in CAD -->

            <!-- Not all matched patterns are rewarded, for example, a combination 
                of shirts and pants priced over $120 if a combination of shirts and 
                pants which is priced at $100, it should be eliminated, for most 
                cases this filter is not required and therefore a DummyPatternFilter 
                is used -->
            <PatternFilter impl= "com.ibm.commerce.marketing.promotion.condition.DummyPatternFilter" />
            <!-- First range 100 <= spending <= 200 -->
            <Range impl= "com.ibm.commerce.marketing.promotion.reward.DistributionRange">
               <!-- For future purchase, choice not supported in this release -->

                  <!-- This reward, if the spending total of ALL matched patterns 
                      falls into the range of 100 to 200 -->
                  <Reward impl= "com.ibm.commerce.marketing.promotion.reward.DefaultReward">
                  <AdjustmentFunction impl="com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction">

                     <!-- Reward can be associated with a sub set of the items 
                         that make up the pattern,the input of this filter chain will 
                         be one matched pattern, and a sub set of items that make up 
                         that pattern is returned and adjustments are associated with 
                         the returned items also known as affected items -->
                     <FilterChain impl= "com.ibm.commerce.marketing.promotion.condition.FilterChain">
                        <Filter impl= "com.ibm.commerce.marketing.promotion.condition.DummyFilter" />

                     <!-- the adjustment -->
                     <Adjustment impl= "com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">
                        <!-- This adjustment is applied to the entire order, 
                            possible values are: (case insentitive)
                            wholeOrder:  The entire order, that is, $15 dollars off 
                                         an entire order
                            AllAffectedItems: Affected items returned by the filter 
                                         chain defined above, that is, $15  dollars 
                                         off all of the affected items as a whole.
                           IndividualAffectedItems: Adjustments are applied to 
                                         affected items individually, that is, $15 
                                         dollars off each and every affected item.


         <!-- Another range, $200 < spending -->
         <Range impl="com.ibm.commerce.marketing.promotion.reward.DistributionRange">
               <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.DummyFilter" />
                     <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">