[ic] Retain shopping cart after browser restart

Jon Jensen jon at endpoint.com
Tue Dec 1 18:01:46 UTC 2015


On Tue, 1 Dec 2015, Grant wrote:

>> I noticed that Interchange loses the session once the browser is closed 
>> and re-opened.  Is there a way to make it persistent so that the 
>> shopping cart contents are retained like Amazon?
>
> It looks like I may be out of luck as far as keeping sessions 
> persistent:
>
> http://www.icdevgroup.org/pipermail/interchange-users/2011-January/052595.html
>
> If so, is there a preferred method of retaining shopping cart contents 
> in the same browser across sessions without requiring the user to log 
> in?  If there is not, should I simply use set-cookie to save the current 
> cart contents at every page load and read-cookie whenever creating a new 
> session?

In that email from Mike that you pointed to, he pointed at how to do it 
(while also explaining why it's not the default).

You need to set an expiration date on the MV_SESSION_ID cookie so it will 
persist after the browser is closed.

You can do this by setting a GlobalSub in your interchange.cfg like this 
(to make the cookie last 1 week, for example):

GlobalSub <<EOR
sub set_cookie_expire {
     $Vend::Expire = Vend::Config::time_to_seconds('1 week') + time();
     return 1;
}
EOR

And then running it on every page load by setting an Autoload in your 
catalog.cfg like this:

Autoload set_cookie_expire

Jon

-- 
Jon Jensen
End Point Corporation
https://www.endpoint.com/



More information about the interchange-users mailing list