Urgent: Remove discounts by code

This is a discussion on Urgent: Remove discounts by code within the Commerce server forums in Microsoft Tools category; Hello, I have a problem that is kind of urgent. I'm running CS2002 (base version, not FP1), and the client needs to set up a discount that only applies "once-in-a-lifetime", ie one time no matter if you log in/out, something not possible in CS2002 base version. My thought was to make a simple database table, where I store a user id as soon as they have used their discount, this doesn't seem to be a problem. However, I need to check this table for each new order and if the user has already used their discount, remove it from the ...

Go Back   Application Development Forum > Microsoft Tools > Commerce server

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 01-15-2008, 05:38 AM
Eric
Guest
 
Default Urgent: Remove discounts by code

Hello,

I have a problem that is kind of urgent. I'm running CS2002 (base
version, not FP1), and the client needs to set up a discount that only
applies "once-in-a-lifetime", ie one time no matter if you log in/out,
something not possible in CS2002 base version.

My thought was to make a simple database table, where I store a user
id as soon as they have used their discount, this doesn't seem to be a
problem. However, I need to check this table for each new order and if
the user has already used their discount, remove it from the basket.

Where/how can I remove discounts? Seemingly there is only properties
to read as of what discounts has been applied, I can't find how to
remove an applied discount from an existing basket. Can anyone give me
a few pointers? The campaign will launch very soon so I'm in a bit of
a stressful situation here :-(

Kind Regards,
Eric
Reply With Quote
  #2  
Old 01-15-2008, 10:43 AM
Eric
Guest
 
Default Re: Urgent: Remove discounts by code

I'll reply to my own post here.. I came up with something like this:

------

ContentList discounts =
myBasket.OrderForms[0].Dictionary["_discounts"] as ContentList;
RowCollection row = discounts.Search("item_id", <the id of the
campaign>);
if (row.Count > 0)
{
discounts.SetScore(row.RowNum,0, "", "");
myBasket.Save();
PipelineInfo pipelineInfo = new PipelineInfo("basket");
myBasket.RunPipeline(pipelineInfo);
}

---

Basicly what happens is I search _discounts for the discount I want,
and set its Score to 0 if it's found. This works great, but there is a
major problem. It seems the basket is either cached or the change is
not saved, because when I reload the next page the same code triggers
again. Is there any way to "permanently" remove the discount? I
thought the discount score would be saved with the basket, and ignored
for all future pipeline calls.

I'm somewhat of a beginner with Commerce Server, I might be going
about this all wrong. Any hints appreciated.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:03 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.