Primary Address Weirdness

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
MCT2006
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu May 04, 2006 3:20 pm

Primary Address Weirdness

Post by MCT2006 » Wed Aug 18, 2010 8:09 am

We're experiencing some strange behavior on a couple of our development sites. When I'm logged in and go to Manage My Address Book, on first loading the page, it appears everything is working fine, but when I go to edit my Billing Address, it brings up an empty address (all null). After reviewing what happens, when I land on the page, it load everything using my default billing address (primary address id), but when I look in the database at my user, my primary address id is now the next identity field of the address table (an empty address).

If I reload the page, the page appears incorrectly, showing that I have an empty billing address, but the database now show my original primary address id stored in the users table.

We're experiencing this on two of our sites, one that has been customized quite a bit and another that has only been modified for design.

Thanks,
Frank
MarketCenter Technologies, Inc.
~ Able Commerce Premier Partner ~
http://www.marketcenter.net
general@marketcenter.net
877-513-0553
"The Right Fuel For Your Business"

User avatar
MCT2006
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu May 04, 2006 3:20 pm

Re: Primary Address Weirdness

Post by MCT2006 » Wed Aug 18, 2010 8:31 am

I should also add that if I refresh or navigate to this page it switches each time.
MarketCenter Technologies, Inc.
~ Able Commerce Premier Partner ~
http://www.marketcenter.net
general@marketcenter.net
877-513-0553
"The Right Fuel For Your Business"

User avatar
MCT2006
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu May 04, 2006 3:20 pm

Re: Primary Address Weirdness

Post by MCT2006 » Wed Aug 18, 2010 9:38 am

I've done a lot of Response.Write throughout the MyAddressPage control to see if I can see what's happening:

How Many Addresses do we have at Start: 1 <-- Expected
How Many Addresses do we have before InitAddressBook: 1 <-- Expected
How Many Addresses do we have at start of InitAddressBook: 1 <-- Expected
How Many Addresses do we have after basket.Package(true): 1 <--Expected
How Many Addresses do we have in collection just loaded: 1 <-- Expected -- this is after AddressCollection addresses = Token.Instance.User.Addresses;
Just sorted addresses...what's PrimaryAddressId: 87 <-- Expected
Just got IndexOf(PrimaryAddressId). What is it: 0 <-- Expected
Just removed address. What's the count now: 0 <-- Expected
How Many Addresses do we have after InitAddressBook: 0 <-- Back in PageLoad...Expected
Inside PreRender...How many addresses now: 1 <-- Not Expected
Now loop through each address
Address Id: 204 <-- This is an empty address that is somehow getting added to my user.
MarketCenter Technologies, Inc.
~ Able Commerce Premier Partner ~
http://www.marketcenter.net
general@marketcenter.net
877-513-0553
"The Right Fuel For Your Business"

User avatar
MCT2006
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu May 04, 2006 3:20 pm

Re: Primary Address Weirdness

Post by MCT2006 » Wed Aug 18, 2010 10:18 am

Ok, I think I've determined that it's due to the fact that we use a MiniCart control in the header that shows the current amount (price) in the users basket. Because the MyAddressPage control removes the PrimaryAddress from Token.User.Addresses, that address doesn't exist in the Token when the user is called in the MiniCart control. Does anyone have a suggestion for how we can avoid this issue?
MarketCenter Technologies, Inc.
~ Able Commerce Premier Partner ~
http://www.marketcenter.net
general@marketcenter.net
877-513-0553
"The Right Fuel For Your Business"

User avatar
MCT2006
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu May 04, 2006 3:20 pm

Re: Primary Address Weirdness

Post by MCT2006 » Wed Aug 18, 2010 11:48 am

Ok, moving the custom MiniCart control Page_PreRender to Page_Load fixed the issue.
MarketCenter Technologies, Inc.
~ Able Commerce Premier Partner ~
http://www.marketcenter.net
general@marketcenter.net
877-513-0553
"The Right Fuel For Your Business"

User avatar
VonHenry
Ensign (ENS)
Ensign (ENS)
Posts: 3
Joined: Thu Sep 27, 2012 7:55 am

Re: Primary Address Weirdness

Post by VonHenry » Thu Dec 13, 2012 10:43 am

MCT2006 wrote:Ok, moving the custom MiniCart control Page_PreRender to Page_Load fixed the issue.
2 years later, 7.0.7 this is still an issue! /facepalm.
Thanks for the hint here! For us it was our custom/BasketTotalSummary control in the header, but same behavior.
Fix was simply to change the Page_PreRender call to Page_Load. (There was no Page_Load routine previously).

I see no side affects to the total summary, and the "My Address Book" now works properly.

Post Reply