Page 1 of 1
Primary Address Weirdness
Posted: Wed Aug 18, 2010 8:09 am
by MCT2006
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
Re: Primary Address Weirdness
Posted: Wed Aug 18, 2010 8:31 am
by MCT2006
I should also add that if I refresh or navigate to this page it switches each time.
Re: Primary Address Weirdness
Posted: Wed Aug 18, 2010 9:38 am
by MCT2006
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.
Re: Primary Address Weirdness
Posted: Wed Aug 18, 2010 10:18 am
by MCT2006
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?
Re: Primary Address Weirdness
Posted: Wed Aug 18, 2010 11:48 am
by MCT2006
Ok, moving the custom MiniCart control Page_PreRender to Page_Load fixed the issue.
Re: Primary Address Weirdness
Posted: Thu Dec 13, 2012 10:43 am
by VonHenry
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.