1
I developed a virtual store in PHP/Mysql of which I do not use sessions to store products in the trolley, but directly in the database. The process is flowing normally: Product Choice, Cart, Identification, Place of Delivery and Payment.
The payment is being in digital module. Free Market and Moip. The problem is when I arrive at the payment. When I get to this area, I’m resetting the cart and changing the status in the database to P. Currently the status is: A = Open, P = Payment and F = Finalized (after payment confirmation on return to the virtual store in case the credit card changes to F).
Only I paid attention to one detail. When the customer is in the payment part and the internet fall or run out of light, he will have to make the purchase process again, being that the cart is empty with the Status P and with that when arriving again in the payment part, ends up accumulating the values and not creating a new purchase. This is exactly where I can’t find a logical reasoning and need help in this reasoning.
When the customer after going through the processes of the online store and arrive at the payment part, how can I create a new purchase in case the customer wants to return to the store or happen some external problem without accumulating the values of the previous purchases?
I think that’s why you have a session or a cookie.... Because somehow you have to identify this guy again to bring the data back to where he left off...
– MagicHat
Um...if you do not want to accumulate the values, if you have to reset if it is not finished....
– MagicHat
Session has his ID when he logs in. But I created another session called SESSIONID, where I create at the moment the cart is created and in the payment I delete this SESSIONID and create a new one in case he wants to continue buying. This SESSIONID stored in the database too. I’ll see if it works that way.
– user24136
You can pick up the last purchase with P status and put it back in the cart. Many e-commerce use it this way, so I have seen in my user experience.
– aleDsz
Just retrieve the database data and put it back in the cart.
– Wendel Rodrigues