Can't Add Multiple Items with Different Options
Re: Can't Add Multiple Items with Different Options
Ahhh.... I didn't thought that. Great job as always. Thank you very much Joe.
Re: Can't Add Multiple Items with Different Options
I am trying that code and it breaks my site. The product page no longer comes up. I get an error message: [[ConLib:ProductPage]] g:\Home\WWW\contract\contractors-solutions.net\wwwroot\ConLib\BuyProductDialog.ascx.cs(521): error CS1501: No overload for method 'GetBasketItem' takes 1 arguments
I am using the latest version, R8. I just upgraded it last week.
I am using the latest version, R8. I just upgraded it last week.
Contractor's Solutions
www. contractors-solutions.net
www. contractors-solutions.net
Re: Can't Add Multiple Items with Different Options
Which code are you using, code provided by me or Joe? If you are running R8, you don't need to patch Joe's code. My provided code should work for you straight away. Also double check your GetBasketItem method, from the error message, it seems this method requires 1 argument but you are passing none to it.
Re: Can't Add Multiple Items with Different Options
Update GetBasketItem method like this (if you have changed it by chance):
This should solve your issue. Hope it helps.
Code: Select all
protected BasketItem GetBasketItem(bool alwaysCreateNew = false)
{
....................................................................
....................................................................
....................................................................
}
Re: Can't Add Multiple Items with Different Options
I was using your code, nadeem. It doesn't work.
I think the reason it broke when I first tried it, was my code looked like this:
The second line wasn't in your example. I deleted it when I replaced with your code.
I tried it again and the site didn't break. It didn't change anything. It still functions with that stupid "update" button instead of "add to basket"
I think the reason it broke when I first tried it, was my code looked like this:
Code: Select all
// check if we need to initialize dialog from existing item
BasketItem existingItem = GetExistingBasketItem();
if (existingItem != null)
{
AddToBasketButton.Visible = false;
UpdateBasketButton.Visible = true;
Quantity.Text = existingItem.Quantity.ToString();
if (_Product.UseVariablePrice) VariablePrice.Text = existingItem.Price.ToString("F2");
}
I tried it again and the site didn't break. It didn't change anything. It still functions with that stupid "update" button instead of "add to basket"
Contractor's Solutions
www. contractors-solutions.net
www. contractors-solutions.net
Re: Can't Add Multiple Items with Different Options
You need to remove following line of code, have you done that?I tried it again and the site didn't break. It didn't change anything. It still functions with that stupid "update" button instead of "add to basket"
Code: Select all
AddToBasketButton.Visible = false;
Re: Can't Add Multiple Items with Different Options
Thanks for the code Nadeem I like the multiple button idea