Adding Free item to the basket automatically

I need to add free gift automatically to the basket and I don't know how to do it. The product bundle is not a suitable solution since I can give free item on Order Discount.
For example, if we set up a Order Discount like this: Receive a 100% discount on Product A if your order is more than 100$.
Any clue?
Is it possible to iterate over all discounts from the Marketing Discount System, find if the conditions of a discount are met and check if the award is a "100% discount on an item" and add this item to the basket automatically? I looked for this and I think it's not possible.
Thanks
Luc
[680 byte] By [LucGauthier] at [2008-1-8]
# 1

Hi Luc,

You can get the discount list applied on your basket :

  • Product Discount : LineItem.ItemLevelDiscountsApplied
  • Basket Discoutn : LineItem.OrderLevelDiscountsApplied

For each DiscountApplicationRecord you can get the detailled information with this cast : Discount discount = (Discount) marketingContext.Campaigns.GetCampaign(discountApplicationRecord.DiscountId) and check the discount.Condition.ConditionExpression and discount.AwardExpression for know if your discount contains a free product and add it to your basket.

GaelDuhamel at 2007-10-2 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 2

Hi Luc,

I went through your post. My requirement is identical to this.

But you have post the code incorrect. GetCampaign function received CampaignID as the paramter, not the discount id. Could you please post the write code to get the Discount object based on the available discountApplicationRecord.DiscountId property.

Please respond to this code ASAP.

Nazim

Nazim71177 at 2007-10-2 > top of Msdn Tech,Commerce Server,Commerce Server 2007...