I have set up custom session expiration times to be 5 minutes. I am making custom seat information unavailable when a WC product that is a seat is added to cart.
I was able to get the cart to clear when session expire in 5 minutes but I am not able to run an action to make that same seat available back again during cart cleaning process upon session expiration.
The actions "woocommerce_cart_emptied" "woocommerce_cart_item_removed" "woocommerce_remove_cart_item" doesnt seem to be run when the cart is cleared by expired session. Does any of you know how to perform a function when cart clear upon expired session?
You can try following hook woocommerce_cleanup_sessions
Related
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
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.
I'm working on a shopping cart and facing an issue with FOSuserBundle registration flow :
My users can add whatever they want to their cart, being or not logged/registered, but before checking out, i want them to login/register.
The main important thing is that I want after login/registration they can get back the same shopping cart they had before. To achieve it, i'm saving into the user session a random key and i'm saving this random key in the database with all articles data.
I hava no problem with the login flow, the session is kept without any change (symfony preserves all session data), so the user retrieves his session, but my problem is with registration.
When the user wants to checkout and have not an account yet, he needs to register, and when the registration is complete (with FosuserBundle, sending an activation link by mail) the user session is completely resetted so the shopping cart is lost but has not really disappeared : Actually, a weird thing i observed is that the browser seems to deal with 2 different sessions at the same time but in 2 separate tabs, in the old browser tab (before registration), data is still here, but in the new tab the session is cleared
So my question is, is there a way to give back a user his session after a successful registration in Symfony2.1 and while using FosUserBundle?
Thank you in advance
My security config file was the cause
I had to set the option session_fixation_strategy to "migrate", that now works perfectly, thanks
Login/Logout is handled by symfony's 2 security component while registration is handled by FosUserBundle.
You can try to override the registration handler https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_controllers.md and migrate your old session: http://symfony.com/doc/current/components/http_foundation/sessions.html#session-api
I want to create an app , which brings a pop-up when the customer session is about to expire.
So for this purpose I will be requiring customer session value .
Please help .
Thanks .
You cant check session remaining time. Because whenever you access the system session will be automatically refreshed. You can check only that session is available or expire. And There is no php function to get it. But We can do it by ajax. For example your session expire time is 30min. Set ajax for every page get refreshed and calculate that time with minus the 30min. And show your pop up message at what time (remaining time ) you want..!!
It seems my Magento is showing wrong information in my header. When the session expires, it still shows information for a specific user. When I return to the website after a day, I did still see "welcome rolandow!", but then when I click this to access "my account", it asks for my login details.
The welcome message I solved by checking in the Header block with IsLoggedIn() if the user is still logged in. But now it also shows my shopping cart while I am logged out.
It shows the actual shopping cart of the user account that I last used to log in. If I open another browser, alter my shopping cart, and then refresh the browser with expired session, the cart is renewed, so the data must be pulled out of the DB. When I click my account, or want to finish the checkout, it asks for login.
So this must be a cookie / cache problem.
I am using APC cache on the server. I don't have caching plugin's installed. Version is 1.6.2.0.
Any idea's?
Ok, sorry, this was probably just the setting "Persistent Shopping Cart" which can be found under System -> Configuration -> (Customers) Persistent Shopping Cart.
I am displaying a products section where there is an add to cart button.
The user may or may not be logged in.
Instead of maintaining the cart items in session i maintain it in the database with the current session id as reference.
After a few navigation or default session time out the session id is regenerated.
So the current session id does not match with the items added by the user in the database.
So the total items and amount which i display at the top of the page because zero.
I had maintained the cart items in the session in the previous projects so i haven't had any problems.
I am using code igniter frame work
What should i do to sync the regenerated session id of codeigniter and the session id of the cart items. I am using Native Session in codeigniter rather than the default session management which comes with codeigniter. The reason is the session does not work in IE6 because i hope IE6 is not understanding CI's headers or some thing like that.
I want to maintain the cart items in database only. What shall i do?
Or you can use the Native Session of CI
You could use standard PHP sessions - track your own session ID and store that in the DB. Skip the regenerated CI-SessionID entirely.
http://www.php.net/manual/en/session.examples.basic.php
Of course, the downside to this is the sessions aren't stored as cookies in this manner so when a user's session expires - they lose their basket. But you can work around this yourself with either a manual cookie store, or force the user to register/login to save basket data.