Can't Add Multiple Items with Different Options

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 258
Joined: Tue Jul 31, 2012 7:23 pm

Re: Can't Add Multiple Items with Different Options

Post by nadeem » Tue Aug 05, 2014 7:51 am

Ahhh.... I didn't thought that. Great job as always. Thank you very much Joe.

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: Can't Add Multiple Items with Different Options

Post by kwikstand » Fri Aug 08, 2014 7:20 am

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.
Contractor's Solutions
www. contractors-solutions.net

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 258
Joined: Tue Jul 31, 2012 7:23 pm

Re: Can't Add Multiple Items with Different Options

Post by nadeem » Thu Aug 14, 2014 5:10 am

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.

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 258
Joined: Tue Jul 31, 2012 7:23 pm

Re: Can't Add Multiple Items with Different Options

Post by nadeem » Thu Aug 14, 2014 6:26 am

Update GetBasketItem method like this (if you have changed it by chance):

Code: Select all

protected BasketItem GetBasketItem(bool alwaysCreateNew = false)
{
   ....................................................................
   ....................................................................
   ....................................................................
}
This should solve your issue. Hope it helps.

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: Can't Add Multiple Items with Different Options

Post by kwikstand » Sat Aug 23, 2014 12:26 pm

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:

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");
            }
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"
Contractor's Solutions
www. contractors-solutions.net

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 258
Joined: Tue Jul 31, 2012 7:23 pm

Re: Can't Add Multiple Items with Different Options

Post by nadeem » Tue Aug 26, 2014 2:29 am

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"
You need to remove following line of code, have you done that?

Code: Select all

AddToBasketButton.Visible = false;

kastnerd
Commodore (COMO)
Commodore (COMO)
Posts: 474
Joined: Wed Oct 22, 2008 9:17 am

Re: Can't Add Multiple Items with Different Options

Post by kastnerd » Fri Jan 23, 2015 10:54 am

Thanks for the code Nadeem I like the multiple button idea

Post Reply