Thankyou - much appreciated.
Thankyou - much appreciated.
Development Manager @ JSWeb Ltd
20 years with Zencart this October!
Ok, I have done a few searches, but I couldn't find anything definitive.
add a checkbox to your login-form called something like "permLogin".
How would I go about adding a checkbox. From your instructions I can definately do the rest, but the checkbox stumps me.
Oh and thank you very much for the instructions, I love that my customers can be logged in all of the time.
Pat
hey, no problem!
it's a template file you should first copy into your own template-directory.
- copy the file "includes/templates/template_default/templates/tpl_login_default.php" to "your_template_dir/templates/tpl_login_default.php"
_- in this file the login box is around line 50. just there add the checkbox with a code like that:
"<input id="permLogin" name="permLogin" type="checkbox" checked> stay logged in"
Good stuff, crazy_chris.
Hi crazy_chris, I just wanted to stop by and thank you for this.
I haven't got it working yet, (I got the tick box and the cookie imbeds it'self, but it does not log me back in again) but I will play around with it and I am sure I will be able to figure it out. It is likely I just put the code in the wrong spot, so I will look at the logic of the statements.
Again, thanks
Pat
Hmm - I get this errorAnd the code I have copied and pasted from above and placed exactly where recommended in includes/modules/pages/login/header_php.php isCode: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 '' at line 1 in: [SELECT customers_password FROM zen_customers WHERE customers_id=]I'm no expert, but there doesn't seem to be anything wrong with that. And I've checked in the db that the required data is present.Code:if (substr_count($_COOKIE["zencart_cookie_permlogin"], "~~~") > 1) { if (empty($_SESSION['customer_id'])) { $c = explode("~~~", $_COOKIE["zencart_cookie_permlogin"]); $q = "SELECT customers_password FROM " . TABLE_CUSTOMERS . " WHERE customers_id=" . $c[0]; $r = $db->Execute($q); $pw_cookie = zen_db_prepare_input($c[7]); $pw_zencart = $r->fields['customers_password']; if ($pw_cookie == $pw_zencart) { $_SESSION['customer_id'] = $c[0]; $_SESSION['customer_default_address_id'] = $c[1]; $_SESSION['customers_authorization'] = $c[2]; $_SESSION['customer_first_name'] = $c[3]; $_SESSION['customer_last_name'] = $c[4]; $_SESSION['customer_country_id'] = $c[5]; $_SESSION['customer_zone_id'] = $c[6]; $_SESSION['cart']->restore_contents(); } } }
Development Manager @ JSWeb Ltd
20 years with Zencart this October!
hey, is this a joke... because you just put the lines in the wrong file!!
the code you just posted (for automatically logging in) is meant to be put in "/includes/modules/pages/index/header_php.php"
the file "includes/modules/pages/login/header_php.php" (where you put the mentioned code) is for the original login-process where you set the cookie for the permanent login.
if you experience any troubles, post again!
Damn - my human side is showing again!
But actually, not as bas as it seemed...I HAD put it in the right place - I had just pasted the wrong filename in that previous post.
Last edited by Ryk; 23 Feb 2007 at 11:38 AM.
Development Manager @ JSWeb Ltd
20 years with Zencart this October!
hehe, alright then
well, it seems, it doesn't find the customer_id in the cookie.
could you please add this code before the "$c = explode(....)":
"echo $_COOKIE["zencart_cookie_permlogin"];"
and post the output here?
Will do . but while I'm doing that, could you be a bit more specific aboutShould it be at about line 72 after $check_country or about line 80 after the $_SESSION lines?does all the stuff around line 70. just after this we hook in. put that code there
This one is in login/header_php.php
Development Manager @ JSWeb Ltd
20 years with Zencart this October!
Bookmarks