Errors showing up since adding more options

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Errors showing up since adding more options

Post by meer2005 » Sun Oct 09, 2016 2:12 am

We added more options to a group of products and are getting errors similar to this in the log. First odd thing is this particular product has 4 options (error log shows two -- 4079,399) and second is I don't even see those option IDs as valid for that product. When I select options for this item, I get this with the option choices ?ItemId=2111561&Options=7658,7564,7570,7576 --- I can't even see how someone would have ended up at this page for this product /product.aspx?productid=185&itemid=2102616&options=4079,399

An error has occured at/product.aspx?productid=185&itemid=2102616&options=4079,399
Exception: Exception of type 'System.Web.HttpUnhandledException' was thrown. Stack Trace: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Inner Exception: The product defines 4 options but 2 choices are provided. Parameter name: productId Inner Exception Stack Trace: at CommerceBuilder.Products.ProductVariantRepository.LoadForOptionList(Int32 productId, Int32[] optionChoices) at AbleCommerce.ConLib.ProductImageControl.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Errors showing up since adding more options

Post by Katie » Mon Oct 10, 2016 2:52 am

Hello,

I'm not sure which version you are using, but the error can happen when the end user has an existing product with options in the basket. If the option configuration changes, then any direct link to the product with the previous option configuration will throw this error.

We fixed the issue in a free service release for Gold R12.

Please see this page for a download and change log - http://help.ablecommerce.com/index.htm# ... ld_r12.htm
The issue you are having is AC8-3142

Thanks,
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: Errors showing up since adding more options

Post by meer2005 » Mon Oct 10, 2016 4:50 am

Using R10, working on upgrading. Is there any way to patch previous versions until we're able to upgrade?

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Errors showing up since adding more options

Post by Katie » Mon Oct 10, 2016 4:56 am

Yes, the fix for this issue is within the following two files.

/Website/ConLib/ProductImage.ascx.cs
/Website/ConLib/BuyProductDialog.ascx.cs

You should be able to download the R12 SR1 patch and merge to your existing files.

Thanks,
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: Errors showing up since adding more options

Post by meer2005 » Mon Oct 10, 2016 12:13 pm

I was able to update Productimage.cs without any issues, but upon updating to the new BuyProductDialog.cs, I get the following:

[[ConLib:ProductPage]] \ConLib\BuyProductDialog.ascx.cs(374): error CS1061: 'CommerceBuilder.Products.Product' does not contain a definition for 'EnableRestockNotifications' and no extension method 'EnableRestockNotifications' accepting a first argument of type 'CommerceBuilder.Products.Product' could be found (are you missing a using directive or an assembly reference?)

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Errors showing up since adding more options

Post by Katie » Mon Oct 10, 2016 12:45 pm

You need to restore your original files and only merge the code fix for this issue. You have merged code from the Gold R12 version for new features that don't exist in your version.

I will try to get you the exact code changes, but I am heading out for today.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: Errors showing up since adding more options

Post by meer2005 » Mon Oct 10, 2016 1:03 pm

Looked like there were quite a few changes between the version. If you could send me the specific code that will fix the issue above it would be greatly appreciated.

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

Re: Errors showing up since adding more options

Post by nadeem » Mon Oct 10, 2016 11:36 pm

Here are the specific code changes required to fix this issue. Open BuyProductDialog.ascx.cs, locate the following code inside GetSelectedOptionChoices() function

Code: Select all

string[] optionChoices = optionList.Split(',');
if (optionChoices != null)
{
      foreach (string optionChoice in optionChoices)
      {
           OptionChoice choice = OptionChoiceDataSource.Load(AlwaysConvert.ToInt(optionChoice));
           if (choice != null)
           {
                _SelectedOptionChoices.Add(choice.OptionId, choice.Id);
           }
       }
           return _SelectedOptionChoices;
}
and replace with

Code: Select all

int[] optionChoices = AlwaysConvert.ToIntArray(optionList);
if (optionChoices != null && optionChoices.Length == _Product.ProductOptions.Count)
{
    foreach (int optionChoice in optionChoices)
    {
         OptionChoice choice = OptionChoiceDataSource.Load(AlwaysConvert.ToInt(optionChoice));
         if (choice != null)
         {
             _SelectedOptionChoices.Add(choice.OptionId, choice.Id);
         }
     }
         return _SelectedOptionChoices;
}
Similarly, open ProductImage.ascx.cs, locate the following code inside Page_Load method

Code: Select all

variant = ProductVariantDataSource.LoadForOptionList(Product.Id, optionList);
and replace with

Code: Select all

int[] optionChoices = AlwaysConvert.ToIntArray(optionList);
if (optionChoices != null && optionChoices.Length == _Product.ProductOptions.Count)
   variant = ProductVariantDataSource.LoadForOptionList(Product.Id, optionChoices);

Post Reply