Bug in minicart
- eggheaddesign
- Lieutenant, Jr. Grade (LT JG)
- Posts: 31
- Joined: Fri Jan 25, 2008 6:17 am
- Location: UK
- Contact:
Bug in minicart
Hi
We just spent some time figuring out an issue that has been reported on these forums but never answered.
The issue is this: the first time somebody browses to your site, they get an object null exception.
This is caused by a potential design flaw in the minicart. This component overrides the preinit event in order to find out who the current user is so that the basket can be populated.
It does this by calling a method in Token.Instance.User in order to find out who the user is. HOWEVER, the first time the user browses to the site, there is no session cookie, and the PreInit event is too early in the request/response cycle for the session cookie to be created. The Token.Instance.User object seems to have some deficiencies in that it returns without problem, but then when you try and do something with the basket, you get the null reference.
We did discover that if the user is unknown, the UserID returned for the User object is 0, so we fixed the problem by adding some code to the minicart to hide it if the UserID is zero.
If I'm honest, I regard this fix as being a bodge - the Token.Instance.User should have some clear way of communicating that the user is unknown.
All the Best
Tony
We just spent some time figuring out an issue that has been reported on these forums but never answered.
The issue is this: the first time somebody browses to your site, they get an object null exception.
This is caused by a potential design flaw in the minicart. This component overrides the preinit event in order to find out who the current user is so that the basket can be populated.
It does this by calling a method in Token.Instance.User in order to find out who the user is. HOWEVER, the first time the user browses to the site, there is no session cookie, and the PreInit event is too early in the request/response cycle for the session cookie to be created. The Token.Instance.User object seems to have some deficiencies in that it returns without problem, but then when you try and do something with the basket, you get the null reference.
We did discover that if the user is unknown, the UserID returned for the User object is 0, so we fixed the problem by adding some code to the minicart to hide it if the UserID is zero.
If I'm honest, I regard this fix as being a bodge - the Token.Instance.User should have some clear way of communicating that the user is unknown.
All the Best
Tony
Re: Bug in minicart
I am unable to reproduce the problem. Could you provide some more detailed information about the reproduction scenario? For example have you placed Minibasket at some location other then the default, is there any specific step involved to reproduce the problem. What is your application version information? Also could you please try to reproduce the problem here on the AbleCommerce 7 demo site.
http://demo.ablecommerce.com/ac7_stable/
http://demo.ablecommerce.com/ac7_stable/
- eggheaddesign
- Lieutenant, Jr. Grade (LT JG)
- Posts: 31
- Joined: Fri Jan 25, 2008 6:17 am
- Location: UK
- Contact:
Re: Bug in minicart
This problem only manifests itself when the first page on the site that the visitor lands on has a minicart on it, and when there is no cookies in the browser cache to identify the user.
Try this: clear your browser cache, and navigate to page that includes the mini basket.
We only spotted the behaviour when we included the minicart on all pages (a design goal of the client's) and released it to UAT - the client's browser had no cookies stored, and the problem showed up
We saw this problem reported but not resolved here:
viewtopic.php?f=42&t=9354&p=41300&hilit ... ecalculate
Cheers
Tony
Try this: clear your browser cache, and navigate to page that includes the mini basket.
We only spotted the behaviour when we included the minicart on all pages (a design goal of the client's) and released it to UAT - the client's browser had no cookies stored, and the problem showed up
We saw this problem reported but not resolved here:
viewtopic.php?f=42&t=9354&p=41300&hilit ... ecalculate
Cheers
Tony
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Bug in minicart
I'm not sure what build you are using, but I don't have that problem when I checked several sites using Build 10863.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Bug in minicart
I have tried by removing all cookies and then placing the control on home page but still unable to reproduce the problem.
-
- Ensign (ENS)
- Posts: 10
- Joined: Wed Nov 26, 2008 5:43 am
Re: Bug in minicart
Our Able Commerce version is as follows:
PLATFORM: ASP.NET
VERSION: 7.1
BUILD: unknown
AjaxControlToolkit: 1.0.10301.0
AvalaraTaxProvider: 1.0.0.0
BPSUtility: 1.0.0.0
CommerceBuilder: 7.0.10576.0
CommerceBuilder.AbleCommerceTax: 7.1.0.0
CommerceBuilder.AustraliaPost: 7.1.0.0
CommerceBuilder.AuthorizeNet: 7.0.9764.0
CommerceBuilder.CanadaPost: 7.0.0.0
CommerceBuilder.CCH: 7.0.0.0
CommerceBuilder.Configuration: 7.0.10576.0
CommerceBuilder.CyberSource: 7.0.9764.0
CommerceBuilder.DataClient.Api: 1.0.0.21
CommerceBuilder.DataClient.Csv: 1.0.0.0
CommerceBuilder.DHL: 7.0.8825.0
CommerceBuilder.DHLInternational: 7.1.0.0
CommerceBuilder.ECB: 7.0.0.0
CommerceBuilder.FedEx: 7.0.9725.0
CommerceBuilder.FRBNY: 7.0.0.0
CommerceBuilder.GoogleCheckout: 7.0.10052.0
CommerceBuilder.InternetSecure: 7.0.9764.0
CommerceBuilder.LinkPoint: 7.0.9764.0
CommerceBuilder.Paradata: 7.0.9764.0
CommerceBuilder.PayFlowPro: 7.0.10061.0
CommerceBuilder.PayJunction: 7.0.9764.0
CommerceBuilder.PayPal: 7.1.10840.0
CommerceBuilder.Protx: 7.1.10124.0
CommerceBuilder.Services: 7.0.10576.0
CommerceBuilder.SkipJack: 7.0.9764.0
CommerceBuilder.UPS: 7.0.10041.0
CommerceBuilder.USPS: 7.0.9728.0
CommerceBuilder.Web: 7.0.10576.0
ComponentArt.Web.UI: 2007.1.1566.3
CyberSource.Base: 2.0.0.0
CyberSource.Clients: 5.0.2.0
CyberSource.Clients.XmlSerializers: 5.0.2.0
CyberSource.WSSecurity: 2.0.0.0
CybsWSSecurityIOP: 1.0.0.0
DataAccess: 1.0.0.0
edtFTPnet: 1.2.4.0
FredCK.FCKeditorV2: 2.5.2912.21007
ICSharpCode.SharpZipLib: 0.85.5.452
LinkPointTransaction: 1.0.1797.29766
log4net: 1.2.10.0
Microsoft.Practices.EnterpriseLibrary.Common: 2.0.0.0
Microsoft.Practices.EnterpriseLibrary.Data: 2.0.0.0
Microsoft.Practices.ObjectBuilder: 1.0.51205.0
Microsoft.Web.Preview: 1.2.61025.0
MySql.Data: 5.0.7.0
NVelocity: 7.0.8530.0
PaygatewayNET: 3.0.0.0
paypal_base: 4.2.1.0
PFProCOMLib: 1.0.0.0
PFProdotNET: 0.0.0.0
SubSonic: 2.0.3.0
Utility: 1.0.0.0
Validators: 1.0.0.0
WebChart: 1.1.1.6
wwHoverPanel: 1.85.0.0
See the last comment on thread viewtopic.php?f=42&t=9354&hilit=basket+recalculate for more information.
PLATFORM: ASP.NET
VERSION: 7.1
BUILD: unknown
AjaxControlToolkit: 1.0.10301.0
AvalaraTaxProvider: 1.0.0.0
BPSUtility: 1.0.0.0
CommerceBuilder: 7.0.10576.0
CommerceBuilder.AbleCommerceTax: 7.1.0.0
CommerceBuilder.AustraliaPost: 7.1.0.0
CommerceBuilder.AuthorizeNet: 7.0.9764.0
CommerceBuilder.CanadaPost: 7.0.0.0
CommerceBuilder.CCH: 7.0.0.0
CommerceBuilder.Configuration: 7.0.10576.0
CommerceBuilder.CyberSource: 7.0.9764.0
CommerceBuilder.DataClient.Api: 1.0.0.21
CommerceBuilder.DataClient.Csv: 1.0.0.0
CommerceBuilder.DHL: 7.0.8825.0
CommerceBuilder.DHLInternational: 7.1.0.0
CommerceBuilder.ECB: 7.0.0.0
CommerceBuilder.FedEx: 7.0.9725.0
CommerceBuilder.FRBNY: 7.0.0.0
CommerceBuilder.GoogleCheckout: 7.0.10052.0
CommerceBuilder.InternetSecure: 7.0.9764.0
CommerceBuilder.LinkPoint: 7.0.9764.0
CommerceBuilder.Paradata: 7.0.9764.0
CommerceBuilder.PayFlowPro: 7.0.10061.0
CommerceBuilder.PayJunction: 7.0.9764.0
CommerceBuilder.PayPal: 7.1.10840.0
CommerceBuilder.Protx: 7.1.10124.0
CommerceBuilder.Services: 7.0.10576.0
CommerceBuilder.SkipJack: 7.0.9764.0
CommerceBuilder.UPS: 7.0.10041.0
CommerceBuilder.USPS: 7.0.9728.0
CommerceBuilder.Web: 7.0.10576.0
ComponentArt.Web.UI: 2007.1.1566.3
CyberSource.Base: 2.0.0.0
CyberSource.Clients: 5.0.2.0
CyberSource.Clients.XmlSerializers: 5.0.2.0
CyberSource.WSSecurity: 2.0.0.0
CybsWSSecurityIOP: 1.0.0.0
DataAccess: 1.0.0.0
edtFTPnet: 1.2.4.0
FredCK.FCKeditorV2: 2.5.2912.21007
ICSharpCode.SharpZipLib: 0.85.5.452
LinkPointTransaction: 1.0.1797.29766
log4net: 1.2.10.0
Microsoft.Practices.EnterpriseLibrary.Common: 2.0.0.0
Microsoft.Practices.EnterpriseLibrary.Data: 2.0.0.0
Microsoft.Practices.ObjectBuilder: 1.0.51205.0
Microsoft.Web.Preview: 1.2.61025.0
MySql.Data: 5.0.7.0
NVelocity: 7.0.8530.0
PaygatewayNET: 3.0.0.0
paypal_base: 4.2.1.0
PFProCOMLib: 1.0.0.0
PFProdotNET: 0.0.0.0
SubSonic: 2.0.3.0
Utility: 1.0.0.0
Validators: 1.0.0.0
WebChart: 1.1.1.6
wwHoverPanel: 1.85.0.0
See the last comment on thread viewtopic.php?f=42&t=9354&hilit=basket+recalculate for more information.
- eggheaddesign
- Lieutenant, Jr. Grade (LT JG)
- Posts: 31
- Joined: Fri Jan 25, 2008 6:17 am
- Location: UK
- Contact:
Re: Bug in minicart
Giles is a lead developer at Egghead....gilesroberts wrote:Our Able Commerce version is as follows:
.....
Re: Bug in minicart
Hi,
I get this issue too, but not with FF or IE. It is occurring only when I use Safari (Windows). I get the error:
Object reference not set to instance...
Not sure at all what the issue is here but will have a go at cracking it.
I get this issue too, but not with FF or IE. It is occurring only when I use Safari (Windows). I get the error:
Object reference not set to instance...
Code: Select all
Line 47: Basket basket = Token.Instance.User.Basket;
Line 48: basket.Package(true);
Line 49: basket.Recalculate();
Line 50: //VALIDATE THE BASKET
Line 51: List<string> basketMessages = new List<string>();
- eggheaddesign
- Lieutenant, Jr. Grade (LT JG)
- Posts: 31
- Joined: Fri Jan 25, 2008 6:17 am
- Location: UK
- Contact:
Re: Bug in minicart
Try clearing the browser cache on the other browsers to see if you get the problem then.
Re: Bug in minicart
I used to get that error before the last update - did it involve Line 49 in minibasket.ascx.cs??
I just commented out "basket.Recalculate();" with no (noticed) ill-effects.
I just commented out "basket.Recalculate();" with no (noticed) ill-effects.