Error during checkout

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
egormsen
Captain (CAPT)
Captain (CAPT)
Posts: 236
Joined: Fri May 16, 2008 9:16 am

Error during checkout

Post by egormsen » Mon Mar 23, 2009 11:34 am

We installed the 7.0.2 upgade build 11659 this weekend and most everthing went fine. But this morning we ran into a problem try to place an order. This order happen to be an international order although I am not sure that is the root of the problem.

When clicking on the "Place Order" button the following error was displayed on the page https://store.weighdown.com/Admin/Order ... etId=11994

It appears that this error is happening in the BindBillingAddress function - to get around the error I changed the following line of code in that function:

if (selectedCountry != null) selectedCountry.Selected = true;

To the following:
if (selectedCountry != null)
{
BillToCountryCode.ClearSelection();
selectedCountry.Selected = true;
}

This change allowed that page to work and the order processed fine. Of course I would need someone to verify that this is not going to have any adverse effects and/or give me a better solution.

Here is the error message that was displayed:

Cannot have multiple items selected in a DropDownList.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: (just the first lines)
[HttpException (0x80004005): Cannot have multiple items selected in a DropDownList.]
System.Web.UI.WebControls.DropDownList.VerifyMultiSelect() +106

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Error during checkout

Post by Naveed » Mon Apr 13, 2009 5:45 am

I can reproduce the above issue by finding a user (on PlaceOrder2.aspx page) whose country is different then the default warehouse country.

Also the above suggested fix is VALID fix.

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Error during checkout

Post by Naveed » Mon Apr 13, 2009 6:00 am

Another better fix is to use "SelectedIndex" property as under:

Find the following lines of code in ~/Admin/PlaceOrder2.aspx.cs (under BindBillingAddress() method)
------------------
ListItem selectedCountry = BillToCountryCode.Items.FindByValue(_Basket.User.PrimaryAddress.CountryCode.ToString());
if (selectedCountry != null) selectedCountry.Selected = true;
------------------

And change them to:
------------------
ListItem selectedCountry = BillToCountryCode.Items.FindByValue(_Basket.User.PrimaryAddress.CountryCode.ToString());
if (selectedCountry != null) BillToCountryCode.SelectedIndex = BillToCountryCode.Items.IndexOf(selectedCountry);
------------------

Post Reply