Logical reasoning for checkout virtual store purchases

Asked

Viewed 137 times

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?

  • 1

    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...

  • 1

    Um...if you do not want to accumulate the values, if you have to reset if it is not finished....

  • 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.

  • 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.

  • 1

    Just retrieve the database data and put it back in the cart.

1 answer

1


I would particularly use a new table:

pedidos
   id_user
   id_product
   ...
   status

As such, when the user logs in you check if he has an order with pending status and puts the items in his cart. I hope I’ve helped.

  • Hello teliz. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.