How to Prevent the Shopping Cart Logging Out Automatically in TomatoCart

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:

————————————————Code————————————————

$expiry = time() + $SESS_LIFE;

————————————————Code————————————————

Replace it with:

————————————————Code————————————————

$expiry = time() + 3600;

————————————————Code————————————————

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:

————————————————Code————————————————

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);

————————————————Code————————————————

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

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

— Find the following code:

————————————————Code————————————————

if (!$SESS_LIFE = get_cfg_var(‘session.gc_maxlifetime’)) {
$SESS_LIFE = 1440;
}

$expiry = time() + $SESS_LIFE;

————————————————Code————————————————

Replace it with:

————————————————Code————————————————

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;
}

————————————————Code————————————————

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.

Looking for quality TomatoCart Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , | Posted under TomatoCart | RSS 2.0

Author Spotlight

Jack Yin

Jack Yin

TomatoCart Developer & Co Founder - Arvixe Web Hosting / TomatoCart Community Liaison

Leave a Reply

Your email address will not be published. Required fields are marked *


5 × = 40

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>