Example: Filter XML fragments

Reviewing the XML representation of some common filters in the runtime promotion XML for a promotion can help you understand how to customize a filter.

This following example code fragments represent promotion filters:

Dummy filter

This filter returns whatever is passed to it.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.DummyFilter" />

Category filter

This filter supports targeting multiple categories. Multiple excluded categories can also be specified.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.CategoryFilter">
   <IncludeCategory>
      <CategoryKey>
         <DN>o=root organization</DN>
         <Name>Store 201 Pants</Name>
      </CategoryKey>
   </IncludeCategory>
   <ExcludeCategory>
      <CategoryKey>
         <DN>o=root organization</DN>
         <Name>Store 201 Sweaters</Name>
      </CategoryKey>
   </ExcludeCategory>
</Filter>

Manufacturer filter

This filter selects items that are manufactured by the specified manufacturer.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.ManufacturerFilter">
   <MFName>Camille Rochester</MFName>
</Filter>

Multiple SKU based filter

This filter supports multiple SKUs. The specified SKU can be either included or excluded. An item can only pass through this Filter when it is on the included list and not on the excluded list.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter"> 
   <IncludeCatEntryKey>
      <CatalogEntryKey>
         <SKU>SKU-20101088</SKU>
         <DN>o=Root Organization</DN>
      </CatalogEntryKey>
   </IncludeCatEntryKey>
   <IncludeCatEntryKey>
      <CatalogEntryKey>
         <SKU>SKU-20101089</SKU>
         <DN>o=Root Organization</DN>
      </CatalogEntryKey>
   </IncludeCatEntryKey>
   <ExcludeCatEntryKey>
      <CatalogEntryKey>
         <SKU>SKU-20101084</SKU>
         <DN>o=Root Organization</DN>
      </CatalogEntryKey>
   </ExcludeCatEntryKey>
   <ExcludeCatEntryKey>
      <CatalogEntryKey>
         <SKU>SKU-20101087</SKU>
         <DN>o=Root Organization</DN>
      </CatalogEntryKey>
   </ExcludeCatEntryKey>
</Filter>

Order quantity filter

This filter is usually used in adjustments, not constraints.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.OrderedQuantityFilter">
   <!-- Potential values: 
        highest: the order in which order items are sorted is highest priced to 
              lowest priced
        lowest: the order in which order items are sorted is lowest priced to 
              highest priced
         -->
   <Type>highest</Type>

   <!-- potential values: 
        exact: select exact X items
        upto: select up to X items 
        minimum: select minimum X items
        rest: select all the items except the first X items where X is the 
              quantity specified in the <NoOfItem> tag
         -->
   <FilterCriteria>exact</FilterCriteria>
   <NoOfItems>5</NoOfItems>
</Filter>

Price comparison filter

This filter is deprecated, and replaced by the OrderedQuantityFilter.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.PriceComparisonFilter">
   <Type>highest</Type>
   <FilterCriteria>exact</FilterCriteria>
   <NoOfItems>5</NoOfItems>
</Filter>

Price threshold filter

Items that pass this filter must be priced over the price specified in this filter .


<Filter impl="com.ibm.commerce.marketing.promotion.condition.PriceThresholdFilter">
   <ThresholdPrice>210</ThresholdPrice>
   <Currency>USD</Currency>
</Filter>

Quantity selection filter

This filter selects X out of a group of Y items. Often used in AdjustmentFunctions not in constraints.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.QuantitySelectionFilter">
   <GroupOf>6</GroupOf>
   <Select>3</Select>
   <!-- Possible values: First, Last, Random -->
   <SelectPosition>First</SelectPosition>
</Filter>

Shipping mode filter

Items pass through this filter has to be shipped with the specified ship mode DN + Store Identifier + Carrier + ShippingCode uniquely identifies a shipping mode.


<Filter impl="com.ibm.commerce.marketing.promotion.condition.ShippingModeFilter">
   <DN>ou=BlueMall B2C Organization,o=Seller Organization,o=Root Organization</DN>
   <StoreIdentifier>BlueStore 201</StoreIdentifier>
   <Carrier>BlueStore 201 Courier</Carrier>
   <ShippingCode>Overnight</ShippingCode>
</Filter>

Total cost pattern filter

The filter matched patterns that can pass through this filter must have a combined total of equal or more than the amount specified in this filter.


<PatternFilter impl="com.ibm.commerce.marketing.promotion.condition.TotalCostPatternFilter">
    <TotalCost>5000</TotalCost>
    <Currency>USD</Currency>
</PatternFilter>

Dummy pattern filter

This filter returns the input pattern.


<PatternFilter impl="com.ibm.commerce.marketing.promotion.condition.DummyPatternFilter" />