Page 1 of 1

Errors showing up since adding more options

Posted: Sun Oct 09, 2016 2:12 am
by meer2005
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)

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 2:52 am
by Katie
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

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 4:50 am
by meer2005
Using R10, working on upgrading. Is there any way to patch previous versions until we're able to upgrade?

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 4:56 am
by Katie
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

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 12:13 pm
by meer2005
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?)

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 12:45 pm
by Katie
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

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 1:03 pm
by meer2005
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.

Re: Errors showing up since adding more options

Posted: Mon Oct 10, 2016 11:36 pm
by nadeem
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);