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.  -->
   <PromotionKey>
      <!-- Name of the promotion -->
      <PromotionName>DollarsOffPromotionOne</PromotionName>
      
      <!-- 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 -->
      <StoreKey>
         <DN>o=Root Organization</DN>
         <Identifier>BlueStore 201</Identifier>
      </StoreKey>

      <!-- 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. -->
      <Version>0</Version>
      <Revision>0</Revision>
   </PromotionKey>

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

   <PromotionGroupKey>
      <GroupName>OrderLevelPromotion</GroupName>
      <StoreKey>
         <DN>o=Root Organization</DN>
         <Identifier>BlueStore 201</Identifier>
      </StoreKey>
   </PromotionGroupKey>

   <!-- Various descriptions of the promotion -->
   <TypedNLDescription impl="com.ibm.commerce.marketing.promotion.TypedNLDescription">
      <DefaultLocale>en_US</DefaultLocale>
      <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>
   </TypedNLDescription>

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

   <!-- 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
   -->
   <Exclusive>3</Exclusive>

   <!-- 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
    -->
   <Status>1</Status>

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

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

   <!-- 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 
      promotion. 
      -->
   <PerShopperLimit>-1</PerShopperLimit>

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

   <!-- 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>
      </DateRange>
      <TimeWithinADay impl="com.ibm.commerce.marketing.promotion.schedule.TimeRangeWithinADaySchedule">
         <Start inclusive="true">00:00:00</Start>
         <End inclusive="false">23:59:59</End>
      </TimeWithinADay>
      <Week impl= "com.ibm.commerce.marketing.promotion.schedule.WeekDaySchedule">
         <WeekDay>Sunday</WeekDay>
         <WeekDay>Monday</WeekDay>
         <WeekDay>Tuesday</WeekDay>
         <WeekDay>Wednesday</WeekDay>
         <WeekDay>Thursday</WeekDay>
         <WeekDay>Friday</WeekDay>
         <WeekDay>Saturday</WeekDay>
      </Week>
   </Schedule>

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

   <!-- 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 
        -->
   <PromotionCodeCue>PXO002</PromotionCodeCue>

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

   <!-- Check the target condition or not -->
   <CheckTargetingConditionAtRuntime>true</CheckTargetingConditionAtRuntime>

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

   <!-- 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">
      <TargetedProfile>
         <CustomerProfileKey>
            <OwnerDN>o=Root Organization</OwnerDN>
            <ProfileName>EmptyNester</ProfileName>
         </CustomerProfileKey>
         <CustomerProfileKey>
            <OwnerDN>o=Root Organization</OwnerDN>
            <ProfileName>DINK Couple</ProfileName>
         </CustomerProfileKey>
      </TargetedProfile>
      <ExcludedProfile>
         <CustomerProfileKey>
            <OwnerDN>o=Root Organization</OwnerDN>
            <ProfileName>Employee</ProfileName>
         </CustomerProfileKey>
      </ExcludedProfile>
   </Targeting>

   <!-- Custom condition can be added here for example:
   <CustomConditions> 
      <Condition impl= "com.myCompany.condition.custom.MyOtherMoreComplexCondition">
      <!-- Where myCompany is a custom package name. -->
         <ConfigParameter1>XXXX</ConfigParameter1>
         <ConfigParameter2>
            <CP2.1>YYYY</CP2.1>
            <CP2.2>ZZZZ</CP2.2>
         </ConfigParameter2>
      </Condition>
   </CustomConditions>
      -->

   <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 --> 
               <LowerBound>1</LowerBound>
  
               <!-- Maximum number of item is not limited -->
               <UpperBound>-1</UpperBound>
 
               <!-- Match as many as items that satisfy the criteria defined in 
                    the filter chain next -->
               <Weight>1</Weight>
            </WeightedRange>

            <!-- 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" />
            </FilterChain>

            <!-- The combination of the quantity requirement and the filter 
                  chain would return everything present in the shopcart as one big 
                  matched pattern -->
  
         </Constraint>
 
      </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 -->
         <Type>Volume</Type>
         <Base>Cost</Base>
         <Currency>CAD</Currency>

            <!-- 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">
               <UpperBound>200</UpperBound>
               <LowerBound>100</LowerBound>
 
               <!-- For future purchase, choice not supported in this release -->
               <RewardChoice>

                  <!-- 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" />
                     </FilterChain>

                     <!-- the adjustment -->
                     <Adjustment impl= "com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">
                        <AmountOff>15</AmountOff>
                        <Currency>CAD</Currency>
                        <!-- 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.
                            -->

                        <AdjustmentType>wholeOrder</AdjustmentType>
                     </Adjustment>
                  </AdjustmentFunction>
               </Reward>
            </RewardChoice>
         </Range>

         <!-- Another range, $200 < spending -->
         <Range impl="com.ibm.commerce.marketing.promotion.reward.DistributionRange">
            <UpperBound>-1</UpperBound>
            <LowerBound>200</LowerBound>
            <LowerBoundIncluded>false</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.DummyFilter" />
                     </FilterChain>
                     <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">
                        <AmountOff>45</AmountOff>
                        <Currency>CAD</Currency>
                        <AdjustmentType>wholeOrder</AdjustmentType>
                     </Adjustment>
                  </AdjustmentFunction>
               </Reward>
            </RewardChoice>
         </Range>
      </Distribution>

   </PurchaseCondition>

</Promotion>