| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.