Question

please, I have an question about CI Cart library and sessions connected with this. I have setted "sess_time_to_update" to 300 secs (default value) and if this time expires I can´t see products which I saved to the Cart. Is it normal? If I look into database, the other datas here are stored, but cart products not. Thank you

Was it helpful?

Solution

Yes it is:

How do Sessions work?

When a page is loaded, the session class will check to see if valid session data exists in the user's session cookie. If sessions data does not exist (or if it has expired) a new session will be created and saved in the cookie. If a session does exist, its information will be updated and the cookie will be updated. With each update, the session_id will be regenerated.

Once the session has expired (or destroyed) any data stored on it will be deleted.

Shopping Cart Class

The Cart Class permits items to be added to a session that stays active while a user is browsing your site.

So you have to save the cart's info in your own table if you want it to persist.

See this nice answer about saving cart's informatino into the database (as string, I mean not ideal way, but it help if you want it to retrieve "the last cart" even if the user's session ends) (if you want to keep this information like forever, better to save properly in your own table not as string): Codeigniter Cart - saving data in database - how to approach?

May be helpful for your need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top