View Customer Profile Error from Order screen

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
SamsSteins
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Jul 10, 2008 11:43 am
Location: Lancaster PA
Contact:

View Customer Profile Error from Order screen

Post by SamsSteins » Fri Dec 17, 2010 9:52 am

I can a customer profile from the order screen, except when a customer creates an account after placing an order as an anonymous user. Then when I go to the original order and click on customer profile I get the following error;


Server Error in '/' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 22: CountryCode.DataBind();
Line 23: //INIT ADDRESS
Line 24: Address address = _User.PrimaryAddress;
Line 25: FirstName.Text = address.FirstName;
Line 26: LastName.Text = address.LastName;

Source File: d:\Domains\samssteins.com\wwwroot\Admin\People\Users\AddressBook.ascx.cs Line: 24

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Admin_People_Users_AddressBook.Page_Init(Object sender, EventArgs e) in d:\Domains\samssteins.com\wwwroot\Admin\People\Users\AddressBook.ascx.cs:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnInit(EventArgs e) +99
System.Web.UI.UserControl.OnInit(EventArgs e) +77
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378

Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618

User avatar
s_ismail
Commander (CMDR)
Commander (CMDR)
Posts: 162
Joined: Mon Nov 09, 2009 12:20 am
Contact:

Re: View Customer Profile Error from Order screen

Post by s_ismail » Mon Dec 20, 2010 6:11 am

Have you customized some thing?

SamsSteins
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Jul 10, 2008 11:43 am
Location: Lancaster PA
Contact:

Re: View Customer Profile Error from Order screen

Post by SamsSteins » Mon Dec 20, 2010 9:56 am

No, I have not customized anything.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: View Customer Profile Error from Order screen

Post by jmestep » Tue Dec 21, 2010 7:22 am

I have had that happen occasionally and haven't completely tracked it down, but I think it might be because of store maintenance deleting anonymous users.
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

User avatar
triplw
Commander (CMDR)
Commander (CMDR)
Posts: 144
Joined: Sat Jan 12, 2008 5:34 pm
Contact:

Re: View Customer Profile Error from Order screen

Post by triplw » Thu Feb 17, 2011 8:00 am

Yes, it's because the anonymous user was deleted. You can see that when you hover on the Profile button that the URL at the botton of the page shows UserId=0. I added a conditional statement in ~/Admin/Orders/OrderMenu.cs

Code: Select all

 protected void Page_Load(object sender, EventArgs e)
    {
        InitOrder();
        if (_Order != null)
        {
            string suffix = "?OrderNumber=" + _Order.OrderNumber.ToString() + "&OrderId=" + _OrderId.ToString();
            Summary.NavigateUrl += suffix;
            Payments.NavigateUrl += suffix;
            Shipments.NavigateUrl += suffix;
            History.NavigateUrl += suffix;
            DigitalGoods.NavigateUrl += suffix;
            GiftCertificates.NavigateUrl += suffix;
            Subscriptions.NavigateUrl += suffix;
            EditAddresses.NavigateUrl += suffix;
            EditOrderItems.NavigateUrl += suffix;
            string packslipUrl = Page.ResolveUrl("PackingList.aspx");

            //Triple W - no error for anonymous users
            if (_Order.UserId != 0)
                Customer.NavigateUrl += "?UserId=" + _Order.UserId.ToString();
            else
            {
                Customer.NavigateUrl = "";
                Customer.Text = "Anonymous User";
            }
            // End

            string fileName = Request.Url.Segments[Request.Url.Segments.Length - 1].ToLowerInvariant();
            switch (fileName)
            {
                case "addpayment.aspx":
                case "editpayment.aspx":
                case "capturepayment.aspx":
                case "voidpayment.aspx":
                case "refundpayment.aspx":
                    Payments.CssClass = "contextMenuButtonSelected";
......................

Post Reply