Customizing promotion organization

You must customize the promotion organization if the default promotion groups are insufficient for your purposes. Specifically, custom groups are required if group promotions in a manner distinct from that provided by the default groups (order level, product level and shipping), such that promotions in the new group are governed by different policies. This customization should occur during store setup. This process includes incorporating the new promotion groups in an invocation template, and associating policies to the new groups.

Also, this scenario assumes that no customization has been done to the persistence management of promotion groups, promotions, or policies.

Prior to customizing your promotion organization, determine whether the custom promotion group is available to all of your stores, or just a subset. You must also determine the name of the group, the policies associated with this group, and how to include this group in the existing promotion evaluation. The following steps detail how to add additional groups, attach policies to them, and use them at run time.

  1. Create the policies assigned to this group

    This step involves inserting one or more entries into the
    PX_POLICY table.

    It is assumed that the policy that is assigned to the group has already been implemented. Custom policies are discussed in Customizing promotion policies. The XMLPARAM field contains the XML definition of the policy. The XML definition looks something like the following:

    <PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy.RedemptionLimitEnforcementPolicy">
          <PromotionPolicyKey>
                <PolicyName>Unique Name for the policy</PolicyName>
                <StoreKey>
                      <DN>o=root organization</DN>
                      <Identifier>BlueStore 202</Identifier>
                </StoreKey>
          </PromotionPolicyKey>
          <Status>Active</Status>
    </PromotionPolicy>
    

The actual content of this XML fragment depends on the XML model for the policy implementation. This case is extremely simple.

  • Create the group

    You need to insert an entry in the
    PX_GROUP table.

    Note the XMLPARAM field. This contains the definition of the group. A sample XML definition looks like the following:

    <PromotionGroup impl="com.ibm.commerce.marketing.promotion.group.PromotionGroup">
       <!-- Key is made up of a reference to the store that owns this group, and a string name -->
       <PromotionGroupKey>
          <GroupName>OrderLevelPromotion</GroupName>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>BlueStore 202</Identifier>
          </StoreKey>
       </PromotionGroupKey>
       <!-status is active -->
       <Status>active</Status>
    
       <!-- Associated policies -->
    
       <AssociatedPromotionPolicies>
          <PromotionPolicyKey>
             <PolicyName>New Policy One</PolicyName>
                <StoreKey>
                   <DN>o=root organization</DN>
                   <Identifier>BlueStore 202</Identifier>
                </StoreKey>
          </PromotionPolicyKey>
          <PromotionPolicyKey>
             <PolicyName>New Policy Two</PolicyName>
             <StoreKey>
                <DN>o=root organization</DN>
                <Identifier>BlueStore 202</Identifier>
             </StoreKey>
          </PromotionPolicyKey>
       </AssociatedPromotionPolicies>
    </PromotionGroup>
    

  • Assign a policy to a group

    This involves populating the
    PX_GRPPOLICY table.

  • Add a group to an invocation template

    Currently, this involves changing the promotion engine configuration XML. For example, you may want the new group to be included in the "All Promotions" template, shared by all stores. First, locate the template definition. Note that , if this group is specific to a store, duplicate the "All Promotions" template definition for the store and modify that duplicate instead.

    The following XML fragment is the section where wildcard template "All Promotions" is defined.

    <Template>
       <TemplateKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <Name>All Promotions</Name>
       </TemplateKey>
       <MonetaryValuePresence>
          <Price>true</Price>
          <ShippingCharge>false</ShippingCharge>
          <Tax>false</Tax>
          <ShippingTax>false</ShippingTax>
       </MonetaryValuePresence>
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>ProductLevelPromotion</GroupName>
       </PromotionGroupKey>
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>OrderLevelPromotion</GroupName>
       </PromotionGroupKey>
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>ShippingPromotion</GroupName>
       </PromotionGroupKey>
    </Template>
    

    Insert your group based on the order in which you want your promotions to be evaluated. For example, if you want promotions in the new group to be evaluated after promotions in the "ProductLevelPromotion" group, the following changes (displayed in bold) are required:

    <Template>
       <TemplateKey
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <Name>All Promotions</Name>
       </TemplateKey>
       <MonetaryValuePresence>
          <Price>true</Price>
          <ShippingCharge>false</ShippingCharge>
          <Tax>false</Tax>
          <ShippingTax>false</ShippingTax>
       </MonetaryValuePresence>
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>ProductLevelPromotion</GroupName>
       </PromotionGroupKey>
          
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>My New Group</GroupName>
       </PromotionGroupKey>
          
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>OrderLevelPromotion</GroupName>
       </PromotionGroupKey>
       <PromotionGroupKey>
          <StoreKey>
             <DN>o=root organization</DN>
             <Identifier>NullEntity</Identifier>
          </StoreKey>
          <GroupName>ShippingPromotion</GroupName>
       </PromotionGroupKey>
    </Template>
    

  • Restarting WebSphere Commerce

    Since promotion groups, policies, and templates are all configuration information, and are cached, restart WebSphere Commerce before the changes take effect.

    Related concepts