Get Discounts for a given Promotion code
ravikanth | April 9, 2009I want to show the discount applicable for a given promotion coupon code and I feel this is one of the genuine requirement. I tried to play with the API to make this work. If we check back the associations between objects, the coupon code is stored under promotion, the promotions are associated to discounts and discounts are associated to campaign.
|
Campaign |
If you check data management object structure, Promotion code and campaigns are easily created and these are associated to a discount.
To check which promotion code is assigned to a discount, I think it would be simple. First – get all list of discounts and check for desired promotion code in each discount.
The real trick comes when we want to show the discounts based on the coupon code. I didn’t tried using API but I feel to write a simple script instead of iterating hundreds of discount options. Here is the script that gives the discount name associated for a particular coupon code.
|
Select u_campitem_name (Select p.[i_pcdef_id], d.[u_pc_code] |
Note: replace “ABCD1234” with your coupon code.