Hello.
I need to be able to add multiple products to a basket in on shot. (at ProductDetail.)
Basket basket = Token.Instance.User.Basket;
BasketItem basketItem1 = BasketItemDataSource.CreateForProduct(_ProductId, (short)tempQuantity, optionList, null);
basketItem1.BasketId = basket.BasketId;
BasketItem basketItem2 = BasketItemDataSource.CreateForProduct(_ProductId, (short)tempQuantity, optionList, null);
basketItem2.BasketId = basket.BasketId;
basket.Items.Add(basketItem1);
basket.Items.Add(basketItem2);
basket.Save();
List<string> basketMessages;
if (!basket.Validate(out basketMessages))
{
Session.Add("BasketMessage", basketMessages);
Response.Redirect(NavigationHelper.GetBasketUrl());
}
If I use Validate() function, only add one item to basket.
other items is removed with "The item is out of stock. It has been removed from the basket." message. (at Basket)
If I don't use Validate() function, add all items to basekt.
I'm afraid that don't use validate() function.
Please help me.
Thank you.
How to add muti items to basket?
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: How to add muti items to basket?
You could look at CategoryGridPage3 -- it allows adding of more than one item with one add to cart button. You could adapt that code to your purpose.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: How to add muti items to basket?
If you don't want the customer to enter any number of quantity and want to restrict him to a specific number then simply go to Edit Product page and set MinQuantity and MaxQuantity . For example if you want customer must always purchase 5 items of this product then min/max should be set to 5.
Re: How to add muti items to basket?
I want to add product(multi options) to Basket in one shot. not multi product.
I'm sorry for confusing.
Thank you.
I'm sorry for confusing.
Thank you.