View Single Post
  #1  
Old 04-28-2008, 01:51 AM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Keeping the users loged in and keep anonimous users cart content

Problem:

How to keep users logged in and anonymous users to keep cart and wishlist contents.

In auth.php find the line
PHP Code:
include_once $xcart_dir."/init.php"

and replace it with...
PHP Code:
#
# If the user has been here in the last 6 month, extract the session ID from a cookie
#
if (!empty($HTTP_COOKIE_VARS["xsessionid"]))
    
$HTTP_POST_VARS["xid"] = $HTTP_COOKIE_VARS["xsessionid"];

include_once 
$xcart_dir."/init.php";

#
# Keep user session ID in a cookie for 6 months
#
if ((empty($HTTP_COOKIE_VARS["xsessionid"]) && !empty($XCARTSESSID)) || $HTTP_COOKIE_VARS["xsessionid"] != $XCARTSESSID)
    @
setcookie("xsessionid"$XCARTSESSIDtime()+3600*24*180); 


in config.php find the line
PHP Code:
$use_session_length 3600
and replace with the line which will extend keeping session data (cart contents, wishlist contents etc.) for 6 months
PHP Code:
$use_session_length 180*24*3600


in modules\Users_online\registered_user.php find the line
PHP Code:
$expiry_time $curtime $config["Sessions"]["session_length"]; 
and change it with the line which will decrease the counter of the online users to only those users which were active in the last 5 minutes (300 seconds):
PHP Code:
$expiry_time $curtime 300


This should keep the user session id for 6 months and everyone who has been logged in will be remembered during that period. What is even more important, anonymous users cart will stay remain.

Important:
Please try it on a test server before you implement it!
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote