Troubleshooting Issues related to promotion code being Invalid
If a promotion code has been entered and the promotion code has been determined to be invalid, the following would be a sample message seen in the trace file:
[12/13/13 17:19:15:198 MST] 000000b7 CommerceSrvr A com.ibm.commerce.marketing.commands.PromotionCodeAddRemoveControllerCmdImpl validatePromotionCode Promotion code "WELCOMEBACK" is invalid.
which indicates one of the following things:
PromotionCodeAddRemoveControllerCmdImpl controller command is where the trigger point for the method "validatePromotionCode()" invocation starts and the default implementation of that method is in the DefaultGenericPromotionCodeManager class.
PromotionEngineHome.getDefaultEngine().getPromotionCodeManager().validatePromotionCode() --> has the actual logic to validate the promotion:
Performs the following tasks:
- Checks if the code is valid
- Checks if the promotion identified by this code is active
- Checks if the promotion identified by this code has reached the redemption limit both overall and for this user in particular
Not checked are:
- If the promotion identified by this code is applicable to the current order based on its content
- If the promotion identified by this code will be eliminated as a result of policy violations.
There are 3 scenarios:
- The promotion code 'WELCOMEBACK' doesn't exist.
- The promotion code can only be used once, and has already reached that limit.
- When promotion code entered is invalid, that is, can not be resolved to a promotion based on the store_id and promotion code provided.
1. Check the PX_Promotion table to check if the promotion exists
You can run the following query:
select PX_PROMOTION_ID, NAME, STORE_ID, STATUS, CODE from PX_PROMOTION where CODE like '%PROMOCODE%'
Check that the status of the promotion is set to 1 (1 being active)
The status column is defined as follows:
2: marked for deletion
Only public promotion codes are listed in CODE column in PX_PROMOTION table
Unique codes wont be listed in PX_PROMOTION → check PX_CDPOOL
2 Performance APARs to take into consideration:
JR45152 → made PX_CDPOOL table non-stagable (This makes PX_CDPROMO obsolete - no longer populated) but adds 3 additional columns (TASK GROUP, REFERENCE (PX_PROMOTION_ID) , WORKSPACE) for the purpose of linking back to the PX_PROMOTION table
Even though CMC allows to remove/delete/update the promo codes associated with any promotion. When the customer is working on a task the data doesn't go to write schema but it directly gets updated to base schema in px_cdpool tables with workspace and taskgroup columns updated. When approving the task group, the data is not taken to live DB but after a stage prop is performed where the 3 newly introduced columns are updated with the correct base schema values and new promo codes are usable.
This is because APAR JR45152 converts the PX_CDPOOL to an unmanaged table thus any changes done in workspace will be committed to the base schema directly upon task group approval, none will be stored in the write schema.
2. Check the runtime XML file for the promotion and ensure that the redemption limit is set as expected:
positive number: the limit
In this scenario, if a shopper has already used that promotion, the same shopper will not be able to use it again thus it will appear in the trace file as invalid. Check to make sure that the customer has set the redemption limits per their requirements
Sample message seen in the trace file would be:
Promotion codes entered: [WELCOMEBACK]
Promotion [B2B, Welcome Back 2014, 1, 0] evaluated in engine
PromotionEngine is <<Qualified>> Promotion Code: WELCOMEBACK
Targets Order Items:
Item (865005, SKU=32002-10, s=0, q=1)
Item (865005, SKU=32002-10, s=0, q=1)
Promotion [Welcome Back 2014] has the following effect
Total Adjustment on the price is: 8.250000
Total Adjustment on the taxes is: 0
Total Adjustment on the shipping charge is: 0
Total Adjustment on the shipping tax is: 0
On item : Price Adjustment=8.250000 Tax Adjustment=0
Shipping Charge Adjustment=0 Shipping Tax Adjustment=0
Promotion [B2B, Fix Jan 2010 10 percent, 1, 0] evaluated in engine
PromotionEngine is <<Eliminated>> due to violate of policy [Product: Enforce the redemption limit] Promotion Code: WELCOMEBACK
3. If the code cannot be resolved to a promotion based on the store_id and promotion code provided, check the following:
The store in the runtime XML file or the PX_PROMOTION table that the promotion is defined for
Note: If an e-site store is trying to make use of the common promotion, check the STOREREL table to check the promotion store relationship (-23) is correctly defined. If it is not, then this would explain why you are unable to resolve the promotion code to the promotion.
You can run the following queries in this case:
select * from store where store_id in (STORE_ID, RELATEDSTORE_ID)
select * from storerel where store_id in (STORE_ID, RELATEDSTORE_ID) and streltyp_id = -23
Information regarding promotion codes
→ It is important to understand that the business user must enter unique promotion codes when creating promotions. If duplicate promotion codes are used for two or more promotions, the WebSphere Commerce Server will have no method by which to determine which promotion should be applied. A promotion will be randomly chosen to be applied to the purchase.
→ OOB, we do not allow customers to apply more than one promotion codes belonging to the same promotion to one order.