Commerce Server Blog

Build world class ecommerce applications using Microsoft Commerce Server
  •  
  • Home
  • Advertise
  • Copyright Policy
  • Disclaimer
  • About

Get Discounts for a given Promotion code

ravikanth | April 9, 2009

I 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
|
Discount
|
Promotion Code
|
Coupon code

If you check data management object structure, Promotion code and campaigns are easily created and these are associated to a discount.

image

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
from (
SELECT a.[i_pcdef_id], b.[u_campitem_name]
  FROM [mktg_order_discount] a , [mktg_Campaign_item] b 
WHERE a.i_campitem_id = b.i_campitem_id
and b.[b_campitem_active] = 1
) discounts,

(Select p.[i_pcdef_id], d.[u_pc_code]
from
[mktg_promocode_defn] p , [mktg_promocode] d 
Where p.[i_pcdef_id] = d.[i_pcdef_id]
)
promo
where discounts.[i_pcdef_id] = promo.[i_pcdef_id]
and promo.[u_pc_code] = ‘ABCD1234′

Note: replace “ABCD1234” with your coupon code.

Categories
Commerce Server 2009, commerce server 2007
Comments rss
Comments rss
Trackback
Trackback

« Error: No content selection context with the name ‘Advertising’ exists for the site ‘MyDefaultSite’ Commerce Server 2009 – Inline Product Property Edition »

Leave a Reply

Click here to cancel reply.

Sign up for Newsletter


Categories

Quiz

  • Catalog Quiz for Beginners
  • Profile Quiz for Beginners
  • Quiz 1 for Advance Users
  • Quiz for Beginners

Recent Posts

  • Staging Deployment – Security Considerations
  • Pipeline Editor displays registered custom pipeline components as unknown in 64 Bit version.
  • How commerce server staging works
  • Steps to extend payments in Commerce Server 2009
  • Introduction to Commerce Server Staging
  • Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information
  • Commerce server staging throws Remote authorization failed to server. Ensure the service has access to this server.
  • Updated Commerce Server 2009 template pack for SharePoint 2007 released
  • RCXml2Resx.exe tool stops working
  • Commerce Server Profile Importer Tool

Archives

  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008

Tags

add discounts add images to profile Advantages of commerce server approve discounts authentication auto login process automatic user creation basket Brand Management business tools campaign management Catalog catalog import Category commerce server commerce server 2007 commerce server manager Commerce Server SP2 commerce server staging discounts ecommerce Estimation Installation inventory Kanth Koppala marketing system migration error Mojave operation components operation sequence Order subsystem Product profile profile subsystem property metadata purchase order quick checkout Ravi Ravi Kanth site cache refresh starter site tools transactions error Variant
(c) 2009 Commerce Server Blog. All rights Reserved. Articles cannot be reproduced without permission from the author.Write to me at kanth@ravikanth.net if you have any comments, questions, suggestions about this site or would like to send us a tip
About Us | Terms of Use | Disclaimer | Advertise .