Customizing promotion organization
If the default promotion groups (order level, product level and shipping) do not meet your business needs, you can customize your promotion organization. Specifically, you can create custom groups that are different from the default groups so that promotions in the new groups 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 these new groups.
Before you begin
This scenario assumes that no customization exists to the persistence management of promotion groups, promotions, or policies.
Before customizing your promotion organization, you must 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 that are associated with this group, and how to include this group in the existing promotion evaluation. The following steps detail only how to add more groups, attach policies to them, and use them at run time.
Procedure
-
Create the policies that are assigned to this group. To create these policies, you must insert
one or more entries into the PX_POLICY table. To help create your policies,
consider using a default policy as a base to model your new policy. To find the default policies
that are assigned to your store, open a database connection and run the following query:
SELECT * FROM PX_POLICY WHERE STOREENT_ID=storeId;
In the results from this query, theIMPLCLS
column defines the name of the class that implements a policy. TheXMLPARAM
column contains the XML definition of a policy. The actual content of this XML fragment depends on the XML model for the policy implementation. A sample XML definition for a promotion policy resembles the following code:<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>
You can use an XML definition that returns from your query to help model your new policy. For more information about custom promotion policies, see Customizing promotion policies.
-
Create the promotion group by inserting an entry for your group into the PX_GROUP table. To help create the entry for your group, you can use an existing group
entry as a model for creating your group. To find the default groups that are assigned to your
store, run the following query:
SELECT * FROM PX_GROUP WHERE STOREENT_ID=storeId;
In the results that are returned from your query, theXMLPARAM
column contains the XML definition of the promotion groups. A sample XML definition for a promotion group resembles the following code:<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 each promotion group you are creating. To assign a policy to a group, you
must insert an entry into the PX_GRPPOLICY database table. This entry associates
the
PX_GROUP_ID
of your promotion group with a specific policy,PX_POLICY_ID
. -
Add your group to an invocation template by updating the promotion engine configuration XML. To
add a group to an invocation template, you can edit an existing template, or duplicate a template
and modify it to meet your requirements. If you want your new promotion group to be shared by all
stores, you can add an entry for your group to the existing "All Promotions" template. If your group
is specific to a store, you must duplicate a template and modify that template specific to your
store.
- Restart HCL Commerce. Since promotion groups, policies, and templates are all configuration information, and are cached, you must restart HCL Commerce before the changes take effect.