I have installed this Version of the Module:
Author: Linxor
Version: 1.3
Zen Cart™ Version: v1.3.8
Update added on Nov 06 2009
The Problem I have: Going to Admin > Configuration > Customer Details I loaded the "Automatic Login (days to remember)".
But there, I can't set the days but "true" or "false".
So, this sql-patch is not correct:
How do I get a input-field for days rather than "true/false"?Code:insert into `configuration` (`configuration_id`,`configuration_title`,`configuration_key`,`configuration_value`,`configuration_description`,`configuration_group_id`,`sort_order`,`last_modified`,`date_added`,`use_function`,`set_function`) values ( NULL,'Automatic Login (days to remember)','PERMANENT_LOGIN_EXPIRES',14,'Automatic Login - Number of days to remember the user','5','102',NULL,now(),NULL,'zen_cfg_select_option(array("true", "false"), ');
I installed this mod successfully. I would like to add an additional feature on the login header. If customer logged in already, i would like to display customer's first and last name follow by [Logout]. This is very similar to Welcome message on the main page, except for i would like to have it display on the header file. The benefit of it is to let customer know that his session is still active. How do i accomplish this?
In file, /includes/languages/english/MYTEMPLATE/header.php
I changed define('HEADER_TITLE_LOGOFF', '[Log Out]');
to
define('HEADER_TITLE_LOGOFF', %s[Log Out]');
The display result shows the same. What is the actual variable to represent current user's first and last name?
i also can't get this mod work out.
i have checked code many times
but i can't seek any cookie should be generated.
how can debug it.
i am not a coder.
anybody can help?
also the configuration of days not work, to be true/false option.
I want to uninstall this module and clear the data from the database. Anybody can help??? Thanks a lot!
Hi, just an update
I use this module with the tip from b00n, it works OK, i have set the cookie life to 1 day, but got frustated when it loged me out the next day(when the cookie expired), i wanted each time when i visit a new page to automaticly add a new lease to the cookie(so that if it did not pass 24 hours from the last click, the site would re-issue the cookie again with the same values but a new expiry date)
This is what i did, in includes/application_top.php (code added in red)
Code://perm login if (PERMANENT_LOGIN == 'true' && substr_count($_COOKIE["zen_cookie_permlogin"], "~~~") > 1) { if (empty($_SESSION['customer_id'])) { $c = explode("~~~", $_COOKIE["zen_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(); zen_redirect( zen_href_link( $_GET['main_page'], zen_get_all_get_params() ) ); } } } if($_SESSION['customer_id']){ unset($c); $c[] = $_SESSION['customer_id']; $c[] = $_SESSION['customer_default_address_id']; $c[] = $_SESSION['customers_authorization']; $c[] = $_SESSION['customer_first_name']; $c[] = $_SESSION['customer_last_name']; $c[] = $_SESSION['customer_country_id']; $c[] = $_SESSION['customer_zone_id']; $c[] = $r->fields['customers_password']; $c_str = implode("~~~", $c); setcookie("zen_cookie_permlogin", $c_str, time() + 86400); } ?>
Last edited by lumpylumpy; 26 Jun 2010 at 11:51 PM. Reason: Mistake in code, corected $c[] = $check_customer->fields['customers_password']; to $c[] = $r->fields['customers_password'];
Hey there,
Thanks, this was helpful. The only problem is, I found it was creating multiple cookies for different paths since it is placed in the application_top file. To fix this, just set the path (and optionally the domain) when you send the cookie.
Make sure you set your logoff header to match.PHP Code:
setcookie("zencart_cookie_permlogin", $c_str, time() + $timeout, "/", ".yoursite.com");
Everything is working perfectly after fixing that.PHP Code:
setcookie("zencart_cookie_permlogin", "expired", time() - 3600, "/", ".yoursite.com");
Hi all
I also use the cited version. Quoted sql-patch is correct. This module works well in my store (1.3.9h)
I stick PERMANENT_LOGIN_EXPIRES in includes/modules/pages/login/header.php:
PHP Code:
// AutomaticLogin module: Allow the user to be automatically logged in. -//
if (!empty($_REQUEST["permLogin"])) {
unset($c);
$c[] = $_SESSION['customer_id'];
$c[] = $_SESSION['customer_default_address_id'];
$c[] = $_SESSION['customers_authorization'];
$c[] = $_SESSION['customer_first_name'];
$c[] = $_SESSION['customer_last_name'];
$c[] = $_SESSION['customer_country_id'];
$c[] = $_SESSION['customer_zone_id'];
$c[] = $check_customer->fields['customers_password'];
$c_str = implode("~~~", $c);
$timeout = 86400 * PERMANENT_LOGIN_EXPIRES; // Change the last number here to the number of days the user should stay logged in
setcookie("zencart_cookie_permlogin", $c_str, time() + $timeout, "/", ".example.com");
}
Before setting this:
log into Your database (via phpMyAdmin),
open "configuration" table ,
search in "configuration_key" PERMANENT_LOGIN_EXPIRES variable,
click "change",
get into "set_function" field and replace:
withPHP Code:
zen_cfg_select_option(array("true", "false"),
That's all - now in Admin You can set the number of days the user should stay logged in. Get: Configuration Menu - Customer Details - Automatic Login (days to remember)PHP Code:
zen_cfg_textarea_small(
Automatic login is very necessary to professionalise the shop module, thank you very much for all of its creators. Good job!
My test site :http://ximap.pl/www/
Zen Cart zen-cart-v1.3.9h-full-fileset-10262010
Mounted mods, all tested and working well in 139h ZC:
- about_us_page_1-3-1
- admin_login_as_customer_2-2
- admin_profiles_1-1-1
- attrib_image_module139h (by my additions)
- ask_a_question_1-3-9h (by my additions)
- AutomaticLogin-1.3.9h (by my additions)
- CRON for Easy Populate 1.2.5.5 (by me and others)
- css_javascript_loader
- Easy Populate 1.2.5.5
- image_handler 2
- product_filter_module_for_zencart_2 (by me and others)
- save_your_sideboxes_layout_as_the_default_1-11
- questions_and_answers_page_1-3-1 (based on about_us_page_1-3-1)
- search_log_2-0
- search_configuration_keys_1-3
- search_helper_1-0a
- search_instock_products_only_1-0
- single_listing_template_1-8
- sms_on_sale_1.1a
Uff![]()
Last edited by alsprog; 7 Feb 2011 at 07:03 PM.
A small note on my test website:
Often on this site is testing new solution, so do not be surprised if you see something wrong - this is normal when web page is in debug mode![]()
Bookmarks