Page 1 of 1

Add option/variant value to AddToBasket.aspx

Posted: Tue Aug 11, 2009 6:14 am
by weblications
I need to be able to add multiple products to a basket in one shot - I can do this with the script below. However, this will not work if there is an option attached to the product - Which I have on every product! Any way to set an option/variant value when uising the script below? Here is my code (VB):

Dim basketItem As BasketItem = BasketItemDataSource.CreateForProduct(_ProductId, 1)
If basketItem IsNot Nothing Then
'ADD ITEM TO BASKET
Dim basket As Basket = Token.Instance.User.Basket
basket.Items.Add(basketItem)
basket.Save()

' IF BASKET HAVE SOME VALIDATION PROBLEMS MOVE TO BASKET PAGE
Dim basketMessages As List(Of String)
If Not basket.Validate(basketMessages) Then
Session.Add("BasketMessage", basketMessages)
Response.Redirect(NavigationHelper.GetBasketUrl())
End If
End If

The basket message is misleading - tells me that the product has been delete.

Any help would be greatly appreciated.

Thanks. Bob