Example: XML representation of a purchase condition

The runtime promotion XML is the name given to the XML representation of a promotion type. The purchase condition element is a key fragment of the full runtime promotion XML; it defines the purchase condition and reward for a given promotion.

This XML fragment is the purchase condition element in the runtime promotion XML for an example promotion:


<PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.PurchaseCondition">
   <Pattern impl="com.ibm.commerce.marketing.promotion.condition.Pattern">
      <Constraint impl="com.ibm.commerce.marketing.promotion.condition.Constraint">
         <WeightedRange impl="com.ibm.commerce.marketing.promotion.condition.WeightedRange">
            <LowerBound>4</LowerBound> 
            <UpperBound>4</UpperBound>
            <Weight>1</Weight>
         </WeightedRange>
         <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
            <Filter impl="com.ibm.commerce.marketing.promotion.condition.CategoryFilter">
               <IncludeCategory>
                  <CategoryKey>
                     <Name>personalizedGift</Name> 
                     <DN>ou=bluemall b2c organization,o=seller organization,o=root organization</DN>
                  </CategoryKey>
               </IncludeCategory>
            </Filter>
         </FilterChain>
      </Constraint>
      <Constraint impl="com.ibm.commerce.marketing.promotion.condition.Constraint">
         <WeightedRange impl="com.ibm.commerce.marketing.promotion.condition.WeightedRange">
            <LowerBound>1</LowerBound>
            <UpperBound>1</UpperBound> 
            <Weight>1</Weight> 
         </WeightedRange>
         <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
            <Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter">
               <IncludeCatEntryKey>
                  <CatalogEntryKey>
                     <SKU>SKU-ITEM-A</SKU> 
                     <DN>ou=bluemall b2c organization,o=seller organization,o=root organization</DN>
                  </CatalogEntryKey>
               </IncludeCatEntryKey>
            </Filter>
         </FilterChain>
      </Constraint>
   </Pattern>
   <Distribution impl="com.ibm.commerce.marketing.promotion.reward.Distribution">
      <Type>Volume</Type>
      <Base>Quantity</Base>
      <Currency />
      <Range impl="com.ibm.commerce.marketing.promotion.reward.DistributionRange">
         <UpperBound>-1</UpperBound>
         <LowerBound>1</LowerBound>
         <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.MultiSKUFilter">
                        <IncludeCatEntryKey>
                           <CatalogEntryKey>
                              <SKU>SKU-ITEM-A</SKU>
                              <DN>ou=bluemall b2c organization,o=seller organization,o=root organization</DN>
                            </CatalogEntryKey>
                         </IncludeCatEntryKey>
                      </Filter>
                   </FilterChain>
                   <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedCostAdjustment">
                      <FixedCost>5</FixedCost>
                     <Currency>CAD</Currency>
                     <AdjustmentType>IndividualAffectedItems</AdjustmentType>
                  </Adjustment>
               </AdjustmentFunction>
            </Reward>
         </RewardChoice>
      </Range>
      <PatternFilter impl="com.ibm.commerce.marketing.promotion.condition.DummyPatternFilter" /> 
   </Distribution>
</PurchaseCondition>