-1
I need to send an email notification of product abandonment in the cart to the customer after X minutes he left the site without buying.
Does anyone know any simple and effective way to check if the user login session is still active on the site?
Example: list all active sessions of the site, if session Y is not active, send the product drop-out email X minutes after the customer leaves the site.
In PHP you can set the session expiration time, plus you can also check if you still have a
session_id()
. and whether the created session is still active:if ($_SESSION['status_sessao'] == 1) { // faz algo } else { //logoff }
. See the php.net to understand how the session works. Start here.– Ivan Ferrer
Ivan, only I won’t have access to the user’s session. That way, what you said wouldn’t work the way I want it to.
– Lucas Lima
What do you mean you won’t have access to the session? It’s the system that controls the session. I’m sorry, but I don’t think you’ve read the PHP documentation. There are other ways to do this, using javascript. But you need to understand how sessions work. Otherwise, I won’t be able to help you.
– Ivan Ferrer
This will all be dynamic. My idea is to make a script that checks whether the user session that abandoned the product in the cart is active or not. If it is active, send an email to him about the product.
– Lucas Lima
And what’s the difficulty in that? I don’t get it. "Do something" would be shooting. You can identify when someone abandoned the cart, you can’t consider the guy’s session. You have to consider when the purchase is not made within a certain time frame. It has nothing to do with session time.
– Ivan Ferrer
Read Berriel’s comment in this post: http://answall.com/questions/115965/howto checkse-uma-sess%C3%A3o-Session-existe-ou-est%C3%A1-active-in-php This is what I was looking for.
– Lucas Lima
You can compare the date the trolley was created, and check if an order was generated on the same date as the trolley. If it was not, you send an email, using crontab to remind the user that he did not give "buy". Scheduling the shooting at the end of the day, for him to receive the message early in the morning. Much simpler and effective.
– Ivan Ferrer
If the guy dislodges, and reloads, he’ll be getting messages...
– Ivan Ferrer
I think that the use of sessions to keep checking what I want will become too complex for something, theoretically, simple. I will only use the data I already have, which is the date the product was added to the cart. If it passes X minutes that was added and the purchase was not finalized, I send the email. To do these checks I will use a script with crontab every Y minutes, I think it is better this way and less complicated.
– Lucas Lima