ProductAccessoriesGrid

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
gardnerr
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Sun Oct 04, 2009 3:57 pm

ProductAccessoriesGrid

Post by gardnerr » Tue Mar 02, 2010 3:16 pm

Hi AbleCommerce,

The following two lines of code in ProductAccessoriesGrid.ascx.cs are causing a null ref exception:

HyperLink addToCartLink = PageHelper.RecursiveFindControl(e.Item, "BuyNowLink") as HyperLink;
addToCartLink.Visible = false;

This happens when one of the products in the accessories grid has had purchasing disabled. The add to cart button is disabled in AddToCartLink.ascx.cs so is this code necessary?

Regards

Rob

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: ProductAccessoriesGrid

Post by mazhar » Wed Mar 03, 2010 6:58 am

Give a try update above two lines of code with these lines, hopefully it will fix it.

Code: Select all

Control control = PageHelper.RecursiveFindControl(e.Item, "BuyNowLink");
if(control != null)
{
HyperLink addToCartLink = control as HyperLink;
addToCartLink.Visible = false;
}

gardnerr
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Sun Oct 04, 2009 3:57 pm

Re: ProductAccessoriesGrid

Post by gardnerr » Sat Mar 06, 2010 5:28 am

Hi,

Could anyone from Able please tell me why, when an exception was thrown on this line, it was not logged either in the db or log file?

Thanks

Rob

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: ProductAccessoriesGrid

Post by mazhar » Sat Mar 06, 2010 9:41 am

I just looked into that, global error loging is happening in Global.asax file's Application_Error event handler. Here we have a code statement ignoring the HTTP exceptions, seems like its to reduce the size of log information because people can type wrong URLs etc and loging all that information may take valuable space. In current case if null exception is being thrown by some code HTTP exception check returns instead of logging the issue because its of type HttpUnhanderledException. I am not sure its intentional for this sort of exceptions or not. Anyhow I am going to open a new bug for this.
http://bugs.ablecommerce.com/show_bug.cgi?id=8784
For you workaround you can simply comment out following line in Global.asax, locate following statement

Code: Select all

if (exception is HttpException) return; 
and change it as below

Code: Select all

//if (exception is HttpException) return;

gardnerr
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Sun Oct 04, 2009 3:57 pm

Re: ProductAccessoriesGrid

Post by gardnerr » Mon Mar 08, 2010 1:20 pm

Hi Mazhar,

Thanks for the reply. As a follow-on from this, I am currently getting the dreaded Invalid Viewstate error on my site. This obviously doesn't normally get logged as it is filtered out in Application_Error. However, I am seeing '/Errors/GeneralError.aspx?aspxerrorpath=/ScriptResource.axd' in my page tracking history every time this happens.

After much research on the Web, I am still unable to reproduce the error, and more importantly, I am unable to tell whether the user does actually see GeneralError.aspx. As the problem could be AJAX related it could be an async call that is getting the error page.

I'd appreciate it if you could clarify whether you believe the user will be seeing the error page. If not, should this be logged in page history?

Thanks

Rob

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: ProductAccessoriesGrid

Post by mazhar » Wed Mar 10, 2010 6:58 am

Please have a look at following thread
viewtopic.php?f=42&t=12541

Post Reply