Quantcast
Viewing all articles
Browse latest Browse all 6

How to prevent the shopping cart logging out automatically?

Some community users face the following problem:

  1. The shopping cart logs me out of the store section if I remain idle for 15 minutes.
  2. The shopping cart logs me out of the store section if I sleep and wake the computer.

After thinking about it, it is necessary to let the store owner sets this time duration in the admin panel. It means the store owner could decide how much time to make the shopping cart logout automatically.

A simple way to resolve your issue via modifying the code as follows:

– Find the session.php in ‘includes/classes’ directory.

– Find the following code:

Replace it with:

Note: the 3600 represent the 3600 seconds. It is equal to 60 minutes. In this way, your shopping cart will be logged out automatically after 60 minutes.

If you wish to config this in the admin panel, please complete the following steps:

– Insert the following sql into your database:

INSERT INTO `toc_configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) 
 VALUES ('Max Life Time', 'SERVICE_SESSION_MAX_LIFETIME', '1', 'The session will be expired after the number of minutes', 6, NULL, '2012-09-14 11:51:06', '2012-09-14 11:51:08', NULL, NULL);

After inserting this sql, please go to Admin Panel->Modules->Services->Session. You will see a new configuration for the session as follows:

Image may be NSFW.
Clik here to view.

– Find the session.php in ‘includes/classes’ directory.

– Find the following code:

if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) { 
  $SESS_LIFE = 1440; 
} 
 
 $expiry = time() + $SESS_LIFE;

Replace it with:

if (defined('SERVICE_SESSION_MAX_LIFETIME') && ((int)SERVICE_SESSION_MAX_LIFETIME > 0)) 
{ 
   $expiry = time() + (int)SERVICE_SESSION_MAX_LIFETIME * 60; 
} 
else 
{ 
   if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) { 
     $SESS_LIFE = 1440; 
   } 
 
   $expiry = time() + $SESS_LIFE; 
 }

 Now, the store will be logged out depends on the Max Life Time you set in the admin panel -> Modules -> Services -Session.

Note: The ‘Max Life Time’ is based on the minutes. If you set it as 15, it represents the 15 minutes.


Viewing all articles
Browse latest Browse all 6

Trending Articles