-
[Done v1.3.7] account creation bug when displaying create-account-success page
Earlier today I installed zencart on my server. I used wget unzip changed the ownership and group on the files to be used by my apache user. Install went smoothly. I go to create a test user and I get the following error.
Code:
Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/eastmedent.com/httpdocs/store/includes/templates/template_default/templates/tpl_create_account_success_default.php on line 26
I did a little research on the forums, thinking that this was a common problem, oddly I found that it only happened when upgrading or using a mod by NotGoddess. Both of which I haven't done, as this is a default install, completely fresh.
A little about my server:
Apache on Red Hat
PHP 4.3.2
MYSQL 3.23.58
I gave it a shot at debugging what's going on and I'm feeling it has to do with line 41 of the the create_account_success header_php.php. But today is one of those days where I just can't think.
PHP Code:
$addressArray[] = array('firstname'=>$addresses->fields['firstname'],
'lastname'=>$addresses->fields['lastname'],
'address_book_id'=>$addresses->fields['address_book_id'],
'format_id'=>$format_id,
'address'=>$addresses->fields);
Any help would be greatly appreciated.
Thanks,
David
-
Re: account creation bug
I can't reproduce the problem unless I delete code from the files, making the array unavailable.
in the header_php.php file, as you mentioned, line 41 produces the array:
Code:
$addressArray[] = array('firstname'=>$addresses->fields['firstname'],
'lastname'=>$addresses->fields['lastname'],
'address_book_id'=>$addresses->fields['address_book_id'],
'format_id'=>$format_id,
'address'=>$addresses->fields);
Then line 26 of the template produces the output by looping through the array:
Code:
foreach ($addressArray as $addresses) {
If the header_php.php file is missing code, then I could see this happening.
I suppose if you failed to actually save a valid address, then the error would appear too, since that array isn't initialized outside of the loop that produces the address data for output.
To initialize the array and suppress the error, you could add this on line 37 of the header_php.php file:
Code:
$addressArray = array();
, right above this line:
Code:
while (!$addresses->EOF) {
Thus, if you have some sort of database problem preventing the address from being saved, or a sessions problem preventing the customer's session id from being retained, then you'll see no address displayed, but also no error.
-
Re: account creation bug
Thanks for your quick reply. The thing is I didn't delete anything from any files as it was a completely fresh install. I have two instances of zencart on my server for two different clients and its the first time this happened. As for saving a valid address I am using my actual address, not some made up one.
But after initializing the array like you said the create_account_sucesss page seems to work fine.
I can't imagine that this is a database issue because even before when the error was occuring my info was being inserted correctly, though I couldn't log in.
Even though you provided a work around, DrByte, if you're interested in looking into this problem further, I'd be more then happy to provide any information you need.
-
Re: account creation bug
I'm puzzled as to why there would be no data returned, and thus trigger the error you mentioned ... as long as you're not importing customer records.
Can you reproduce the error on-demand if the fix above is not applied? Can it be produced repeatedly? If so, please post your server (ie: PHPinfo output) and browser specs.
-
Re: account creation bug
On my powerbook, yeah I can always produce the error in Firefox 2. Using Safari on my coworkers computer it seemed works fine, with the fix off. See php info here.
-
Re: account creation bug when displaying create-account-success page
Your two client sites wouldn't be sharing the same database would they?
-
Re: account creation bug when displaying create-account-success page
I'd like to jump in on this one.......same thing just happened to me. I did a fresh install, new database, everything. Everything was working fine (much smoother than the site I just got done upgrading) but when I went to create a new account I got that same error mentioned above. Also, my page displays funny. The text runs way off to the right side of the page, with the continue button almost off the cart page entirely. All my other pages are fine. I did reload the original file just in case it had become corrupt or something but the error continued. Also reloaded the file that is working now in my live store to see if that helped but the error continues as well. I'm open to any solutions as well. If you would like to test my page go here:
http://www.astudiojdesign.com/new_st...ain_page=login
-
Re: account creation bug when displaying create-account-success page
Did you apply the fix I mentioned earlier?
http://www.zen-cart.com/forum/showth...487#post287867
(Sorry, that's a rhetorical question, since I can see the error on your site if I force the main_page setting. Please apply the fix and then advise if there's still a problem.)
-
Re: account creation bug when displaying create-account-success page
Yes, that helped with the error and formatting problem except it's still not working right. Everything appears to look correct but I have a box under my "success" congratulations message and in the box it says "primary address" in blue but nothing else. I clicked the continue button but it takes me back to the home page. I should mention that I received the email confirmation stating I have successfully created my account. I refreshed my page and tried logging in again but all that happens is the create account page keeps repeating itself. I never am able to log in or check out.
-
Re: account creation bug when displaying create-account-success page
You're saying that:
1. this is a fresh v1.3.6 install with NO addons ?
2. switching to "classic" template has the same effect?
3. you can create an account, but *always* get the indicated error?
4. you can see the account in the admin?
5. the address info as seen in the admin is correct?
6. you cannot log in using this account ?
7. you cannot access My Account to review the information ?
What version of PHP?
What version of MySQL?
What operating system is your server running?
-
Re: account creation bug when displaying create-account-success page
You're saying that:
1. this is a fresh v1.3.6 install with NO addons ? Yes, I haven't added anything to this store.
2. switching to "classic" template has the same effect? Not sure I understand what you mean by "switching" to classic. For now I'm putting everything in my classic folder. This is the template I'm using. After I get it all working I copy all my files over to a renamed folder to use as my override folder.
3. you can create an account, but *always* get the indicated error? Well I've only tried 2x to create an account and yes both times I got the error. Just for laughs, I created a new test account this time NOT choosing the newsletter option. I get the same blue "primary address" box with the continue button. I clicked continue and it takes me right back to the Welcome Please Sign In page.
4. you can see the account in the admin? Yep, I am able to see all 3 test accounts.
5. the address info as seen in the admin is correct? Yes, I just checked again, all info is the same as I entered it.
6. you cannot log in using this account ? No, when I log in it takes me right back to the Welcome, please log in page.
7. you cannot access My Account to review the information ? There is no My Account to view! I have 2 things sitting in a cart, I know I should be able to see those but My Account isn't even an option on top.....or anywhere for that matter.
What version of PHP? 4.4.4
What version of MySQL? 4.1.21 standard log
What operating system is your server running? Linux 2.6.9-42ELsmp
-
Re: account creation bug when displaying create-account-success page
Tried it in both FireFox (v2) and IE6 - I can't seem to duplicate a problem. Was able to complete the registration and am logged into both accounts.
-
Re: account creation bug when displaying create-account-success page
I just created an account on your site with no problem.
I can log into it fine.
I can access My Account fine.
I can place an order fine. Checkout completes fine.
What browser are you using?
-
Re: account creation bug when displaying create-account-success page
IE 7........wouldn't be suprised to find that's the whole problem:(
-
Re: account creation bug when displaying create-account-success page
I just tested it in Firefox and I also was able to create a new account just fine. Perhaps a cache issue? Or maybe it's an issue with IE7?
-
Re: account creation bug when displaying create-account-success page
I just logged in fine via IE7
-
Re: account creation bug when displaying create-account-success page
Well go figure! I dunno, I guess I'll try it again tomorrow after a reboot and see if I continue to have the same problem. I appreciate the point in the right direction with the fix though. It's been very helpful.
-
Re: account creation bug when displaying create-account-success page
No they aren't. DrByte, would you give signing up into my store a shot, as of right now it is unpatched with the initialized array, so it gives me errors in ff2. Plus I also just noticed that I can't log in with ff2. I can with safari though.
-
1 Attachment(s)
Re: account creation bug when displaying create-account-success page
You can't log in because your server isn't set up properly.
-
Re: account creation bug when displaying create-account-success page
I just wanted to let you know that my problem has been solved and I am able to create a new account just fine now. Mine seemed to be a cache issue after applying that small patch that was mentioned in this thread. Thank you to everyone who took the time to test my store!
-
Re: account creation bug when displaying create-account-success page
I am having this exact same problem after upgrading from 1.3.5 to 1.3.6
Where is this header.php file located that the fix is for?
thanks
-
Re: account creation bug when displaying create-account-success page
I don't believe I would call it a 'fix' but the file is includes/modules/pages/create_account_success/header_php.php
As Dr. Byte points out there is something wrong with the query execution if you need to initialize this array since the query if executed properly will fill the array.
You probably have some other problem...
Jeff
-
Re: account creation bug when displaying create-account-success page
Plesk's cert shouldn't matter... because with the initialized array I am able to log in.
-
Re: account creation bug when displaying create-account-success page
It's really not a cert issue at all, but rather a problem with your address book. For some reason the address book sql query is failing to return a result set and so the array is reported as unintialized.
If the line of code that says:
Code:
$addresses = $db->Execute($addresses_query);
is actually executing and returning a result set, the array would not be uninitialized.
Jeff
-
Re: account creation bug when displaying create-account-success page
I see your logic but I don't understand why it would work in safari and not in firefox unless there is some sort of $_POST issue, which I feel that it wouldn't be.
-
Re: account creation bug when displaying create-account-success page
No it wouldn't be a POST issue... it is more likely that either your address book table is corrupted or missing, or out of synch with your customer table with regard to customer_id, etc.
You see, earlier in the account creation process it takes the address information you entered in the form and writes it to the address book... then in this header (where your installation is failing) it looks up that (supposedly just added) address book entry record and fills your addresses array to be used later for things like checkout etc.
In your case the record does not appear to be in the address book, so my guess is the failure is occuring much earlier when it trys to write the record in the first place... that is where you need to look for the source of this problem...
Hope this helps!
Jeff
-
Re: account creation bug when displaying create-account-success page
Jeff, I see your point, its just I think you fail to see mine. Its a completely fresh install on a completely new database. There isn't any way that id's could auto increment without any data to set them off.
Also, that doesn't explain why it works completely fine in safari and breaks in firefox on my mac. But seems to run fine in firefox on xp, that isn't a database issue at all.
I'm sorry if that came off as rude, but there appears to be something more at issue here.
-
Re: account creation bug when displaying create-account-success page
This is a strange one. It works fine in internet explorer but when creating an account using mozilla firefox, I get the error: Warning: Invalid argument supplied for foreach() in /home/sonethrw/public_html/boogiebabystore/store/includes/ templates/template_default/templates/tpl_create_account_success_default.php on line 26
All that is on line 26 on that page is:
foreach ($addressArray as $addresses) {
Then when you click the "continue" button, it loops back into the account creation page and doesn't take you to the checkout screen like it should.
I don't understand why it would work fine in internet explorer, but have a problem in firefox.
I have completely reinstalled version 1.3.6 of zencart and that didn't fix the problem.
Any have any ideas on this?
Heres a link to my site so anyone who wants to look can see what the problem is:
http://www.boogiebabystore.com/store/
-
Re: account creation bug when displaying create-account-success page
... Try clearing your cookies and cache. I can't duplicate the problem using FF v2.
-
Re: account creation bug when displaying create-account-success page
Salina13:
I was able to create an account on your site just fine using FF 1.5 but when I click on your Newest Additions link I do get the following error:
Code:
Warning: Division by zero in /home/sonethrw/public_html/boogiebabystore/store/includes/classes/split_page_results.php on line 76
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-0, 0' at line 10
in:
[SELECT p.products_id, p.products_type, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status FROM zen_products p LEFT JOIN zen_manufacturers m ON (p.manufacturers_id = m.manufacturers_id), zen_products_description pd WHERE p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 order by p.products_date_added DESC, pd.products_name limit -0, 0]
Jeff
-
Re: account creation bug when displaying create-account-success page
Sounds like there is a Maximum Value set to 0 and that is causing the division by zero error ...
-
Re: account creation bug when displaying create-account-success page
That is really strange. I'm going to keep working on it and see if clearing cache and cookies help. Thanks for catching the other error although I don't know where your clicking to get to the newest additions as that is something that I tried to take off of there.
Thanks to everyone who tested it for me.
-
Re: account creation bug when displaying create-account-success page
Just a quick note to anyone who has been watching this thread. I cleared my cookies and cache and that seemed to do the trick.
Thanks to everyone who helped with this.
-
Re: account creation bug when displaying create-account-success page
Yeah, that worked for me too... now how can we insure that a customer doesn't have this happen to them?
-
Re: account creation bug when displaying create-account-success page
Quote:
Originally Posted by
Salina13
I don't know where your clicking to get to the newest additions as that is something that I tried to take off of there.
When you create a new account the link in the home page changes from "Would you like to Login" to "Would you like to see our Newest Additions".
I believe this behavior can be changed to go elsewhere in the admin... I'm sure Linda could tell you exactly! :laugh:
Glad the cache clearing fixed the problems!
Jeff
-
Re: account creation bug when displaying create-account-success page
Quote:
Originally Posted by
twirlerzmom
Yes, that helped with the error and formatting problem except it's still not working right. Everything appears to look correct but I have a box under my "success" congratulations message and in the box it says "primary address" in blue but nothing else. I clicked the continue button but it takes me back to the home page. I should mention that I received the email confirmation stating I have successfully created my account. I refreshed my page and tried logging in again but all that happens is the create account page keeps repeating itself. I never am able to log in or check out.
Yeh, I have the same problem. Applied the fix to header_php.php and no need for me to repeat again what happened above.
-
Re: account creation bug when displaying create-account-success page
mycolumbus try clearing your cache. That's what did the trick for me. It wouldn't work right for me but worked right for a few people here that tested it for me. I couldn't figure it out. I tried again the next morning and all was well on my end too.
-
Re: account creation bug when displaying create-account-success page
Okay, now I understand and can duplicate the problem you are seeing... It occurs when creating an account during the checkout process as most customer of course do.
I believe this problem is do to the recent create account changes. The problem is the $origin_href variable is incorrectly being set to the create account page in includes/modules/pages/create_account_success/header_php.php by this code:
Code:
if (sizeof($_SESSION['navigation']->snapshot) > 0) {
$origin_href = zen_href_link($_SESSION['navigation']->snapshot['page'], zen_array_to_string($_SESSION['navigation']->snapshot['get'], array(zen_session_name())), $_SESSION['navigation']->snapshot['mode']);
$_SESSION['navigation']->clear_snapshot();
} else {
$origin_href = zen_href_link(FILENAME_DEFAULT);
}
Rather than being set to checkout_shipping, where it should redirect to when you press the continue button. Unfortunaltely I don't have an easy solution at the moment but because of the criticality of this problem I'm sure it will be a high priority!
Jeff
-
Re: account creation bug when displaying create-account-success page
Okay, I have a temporary fix to this problem. I'm sure the dev team will have a better one later but this will at least get you by until then...
Locate the line (line 19) in includes/modules/pages/create_account_success/header_php.php that says:
Code:
if (sizeof($_SESSION['navigation']->snapshot) > 0) {
and directly beneath this line add:
Code:
if ($_SESSION['navigation']->snapshot['page'] == 'create_account')
$_SESSION['navigation']->snapshot['page'] = 'checkout_shipping';
This will force the customer to be redirected to the checkout_shipping page (where they should be) after account creation.
Hope this helps!
Jeff
-
Re: account creation bug when displaying create-account-success page
Nope. That didn't fix the problem for me. Still the same situation occurs. I have initialised the array as previously mentioned in this thread with the line:
$addressArray = array();
I've cleared my cache in Firefox, but still it takes me to the create_account_success page without the address info populated. Then upon clicking Continue, it takes me to the login page.
-
Re: account creation bug when displaying create-account-success page
mycolumbus:
Yours is a different problem so my fix will not correct the issue you are reporting.
You need to remove the array initialization code you've added since this is not a fix and concentrate on figuring out why the array is empty in the first place. It stands to reason that either the address book record is not being created as it should be or a session problem is causing the query to fail, for example if $_SESSION['customer_id'] is empty.
Since you are redirecting to the login page that would indicate the latter (no valid session) but I have no idea why.
Is this a fresh install? Have you changed or added any contribs?
Let me know and I will try to help.
Jeff
-
Re: account creation bug when displaying create-account-success page
Thanks for your reply JeffD. Yes, this is a fresh install. You're right, it's a problem with the session because I can't even login as a user that's been created and exists in the database.
Time to go on the search again for my answer.
Thanks.
-
Re: account creation bug when displaying create-account-success page
Fixed!
Sessions > Recreate Session set to false instead of true.
Great. Now I can get on with my job of customizing the store. Thanks everyone for your support.
-
Re: account creation bug when displaying create-account-success page
That is very strange because it should work using the default setting for Recreate Session which is false.
Here are the session setting we are using:
Cookie Domain True
Force Cookie Use False
Check SSL Session ID False
Check User Agent False
Check IP Address False
Prevent Spider Sessions True
Recreate Session False
IP to Host Conversion Status true
I'm glad now it is working for you but you might want to look a bit further as to why you must have Recreate Session True as I don't really feel that should have fixed the problem.
Jeff
-
Re: account creation bug when displaying create-account-success page
You misread my post. I have:
Recreate Session set to False.
My settings are exactly the same as yours. Cheers!
-
Re: account creation bug when displaying create-account-success page
Quote:
Originally Posted by
JeffD
That is very strange because it should work using the default setting for Recreate Session which is false.
Here are the session setting we are using:
Cookie Domain True
Force Cookie Use False
Check SSL Session ID False
Check User Agent False
Check IP Address False
Prevent Spider Sessions True
Recreate Session False
IP to Host Conversion Status true
I'm glad now it is working for you but you might want to look a bit further as to why you must have Recreate Session True as I don't really feel that should have fixed the problem.
Jeff
It seems it did fix this problem. However, my default setting for Recreate Session was True.
Is that possible that this was changed to True when installing some contributions? I am worrying if this would deactivate some modules. Sorry if this is totally irrelavant. I know little about zenning!
I have the following modules installed: EP, google sitemapadmin, SEO, image handler2
Thanks!
-
Re: account creation bug when displaying create-account-success page
mycolumbus:
Sorry, must not have had enough coffee that morning!
stargre:
We have updated our database many times over the years from version 1.14 and now up to the current version. We've never changed Recreate Session AFAIK so I *think* the default is false, however maybe one of the Dev team can comment on exactly what the current default configuration is for Recreate Session?
I'm not aware of any contribs that would change Recreate Session...
Glad it is working now for you both!
Jeff
-
Re: account creation bug when displaying create-account-success page
Confirmed... I too am redirected poorly after creating an account during the checkout process. Seems like a perfect fit for my sessionWatcher contrib though... so I'll see if I can integrate that into it. Of course, its better if it just works properly fresh.
- Steven
-
Re: account creation bug when displaying create-account-success page
Done! Contrib is now updated for this problem. I should clarify that it was actually introducing this issue independently as well, so thanks for helping me fix a bug I didn't know about. It now properly handles the situation where a customer creates an account during checkout.
- Steven
-
Re: account creation bug when displaying create-account-success page
Steven:
Thanks for updating sessionWatcher to correct this issue! I have applied your latest changes since we use your contrib on our sites.
I want to clarify something however...
Everyone running 1.3.6 has this problem... yet they are likely unaware that it exists unless they happen to read this thread.
If someone applies the patch I posted earlier to overcome the checkout/create account redirect problem, will this affect sessionWatcher behavior in any way? In short, have you tested sessionWatcher in an installation using the previously proposed patch? and if so, are there any ramifications? Also, if they are using the latest version of sessionWatcher, do they also have to apply the previous patch?
I believe I know these answers but would appreciate your clarification!
Thanks,
Jeff
-
Re: account creation bug when displaying create-account-success page
Okay, after some testing I will answer my own post...
To clarify this problem:
There is an issue with 1.3.6 whereby after new account creation during checkout, the customer is always redirected back to the create_account page rather than to the checkout_shipping page where they should go to complete the order process.
A quick fix for this issue was posted last Thursday here.
If you install the latest version of Steven's sessionWatcher contrib., he has modified it to do the same thing as the patch, so you don't have to apply the patch.
If you have already applied the patch it's okay as it will have no effect.
So to summarize, either install the sessionWatcher contrib. (this gets my my vote), or the patch or both to correct this issue.
Hope this helps!
Jeff
-
Re: account creation bug when displaying create-account-success page
Quote:
Originally Posted by
JeffD
Okay, after some testing I will answer my own post...
To clarify this problem:
There is an issue with 1.3.6 whereby after new account creation during checkout, the customer is always redirected back to the create_account page rather than to the checkout_shipping page where they should go to complete the order process.
A quick fix for this issue was posted last Thursday
here.
If you install the latest version of Steven's sessionWatcher contrib., he has modified it to do the same thing as the patch, so you don't have to apply the patch.
If you have already applied the patch it's okay as it will have no effect.
So to summarize, either install the sessionWatcher contrib. (this gets my my vote), or the patch or both to correct this issue.
Hope this helps!
Jeff
Hi! I may be missing something here. I didn't apply your patch, or the sessionwatch contribution. I just changed the value of recreatesessions to be false. It fixed the problem. So, maybe there will be some issue I didn't notice? Or do I still need to apply the contributions? Sorry, I am making myself seem even more ignorant.
-
Re: account creation bug when displaying create-account-success page
First, this is a problem with 1.3.6 ONLY... If you have a previous version the problem does not apply!
If you wish to see this issue, follow these steps...
1) Visit your store as a new user.
2) Add something to the cart.
3) Checkout...
4) The cart will prompt you to login or create an account...
5) Choose create account, and submit your information.
6) You will be redirected to the account creation success page (assuming you entered vaild info)...
7) Click the continue button in the success page to witness the problem...
Instead of progressing to checkout_shipping you will be redirected back to the create_account page.
Hope this helps!
Jeff
-
Re: account creation bug when displaying create-account-success page
Well now you have me doubting myself...
Are we *SURE* at this point, that this affects all 1.3.6 users, or is it my contrib that caused the problem in the first place?? I thought I tested on a fresh copy, but maybe I got mixed up... I didn't know you had SessionWatcher going too.
I don't want to install another fresh copy (too busy right now) so can someone WITHOUT sessionWatcher please follow Jeff's instructions and confirm the problem?
Thanks.
- Steven
-
Re: account creation bug when displaying create-account-success page
Argh! I also had sessionWatcher running on our test site where I performed the testing when trying to help stargre and mycolumbus. Ajeh indicates that she cannot duplicate the problem on her test installation but is unsure that her code has not been modified beyond the as released 1.3.6.
Like you I really don't have time to do a clean install so I'm hoping someone (stargre?, mycolumbus?) with a clean install can confirm or deny this problem exists?
Thanks,
Jeff
-
Re: account creation bug when displaying create-account-success page
hehe... that's funny :) So in other words, we managed to steer this thread completely off topic because the bug you and I are talking about may not have anything at all to do with the original problem. YOU STARTED IT!! :) It actually makes sense that sessionWatcher was the culprit. It creates a navigation history for any page that doesn't already have one. This particular case was caused because a navigation history is set on one page (by checkout) and forwarded to a new page (account creation)... but then instead of going directly back to checkout it goes to a THIRD page (account creation success) and sessionWatcher by that point was active again. I hadn't accounted for cases like this where there's a (useless?) intermediary step. Really though... what is the point of the success page? With or without my contrib, I would suggest that it would flow better if the customer was taken directly back to the checkout rather than having to hit "continue" to do so.
Sorry for inadvertently contributing to Jeff's inadvertent hijacking of this topic! You may now resume your normal bug.
- Steven
-
Re: account creation bug when displaying create-account-success page
Quote:
Really though... what is the point of the success page? With or without my contrib, I would suggest that it would flow better if the customer was taken directly back to the checkout rather than having to hit "continue" to do so.
Yes, and I believe that is the exact issue that put me off track since this is something newly added to Zencart. Originally after account creation older version of Zencart redirected back to checkout shipping page rather than having a continue button. I assumed (and probably incorrectly so now) that the culprit was in the addition of the success page and it's continue button.
Profusley apologizing now for that mistake! :lamo:
Jeff
-
Re: account creation bug when displaying create-account-success page
What I saw with a clean install of 1.3.6 is that without changing the resetsessions value, this problem does happen every time. But after reset it, without applying either the patch mentioned earlier or the contribution, it worked fine. I am not good enough to make any conclusions. But that's what I can report.
-
Re: account creation bug when displaying create-account-success page
The bypass of the create-account-success page has been built-in to v1.3.7.
-
Re: account creation bug when displaying create-account-success page