Basket Recalculate() Generates new BasketItems

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
spirituc
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Wed Jan 19, 2011 12:01 pm

Basket Recalculate() Generates new BasketItems

Post by spirituc » Thu Jan 20, 2011 11:29 am

Hello.

I have this code to add Basket Items to my Basket:

BasketItem bi = new BasketItem();

bi.ProductId = productId;
bi.Quantity = (short)(bi.Quantity + 1);

this.CurrentBasket.Items.Add(bi);

this.CurrentBasket.Save();

this.CurrentBasket.Recalculate();

Before the Recalculate I have Count=1 in this.CurrentBasket.Items, after I have 3.

Any idea why this happens? Am I creating correctly the BasketItem?

Thanks ,

Bruno Martinho

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Basket Recalculate() Generates new BasketItems

Post by mazhar » Mon Jan 24, 2011 6:23 am

When you trigger recalculate on basket it enforces many calculations like it may automatically apply discounts valid for your basket item. There are different types of basket items like Product, Coupon, Discounts, Shipping etc. I think in your case these extra items may be shipping and discounts but you can try to confirm this by looking at details of these two extra basket items.

Post Reply