Logical reasoning for the completion of virtual store purchases

1

I developed a virtual store in PHP / Mysql from which I do not use sessions for storing products in the cart, but directly in the database. The process is flowing normally: Product choice, Cart, Identification, Place of delivery and Payment .

Payment is in digital module. Free Market and Moip. The problem is when I get paid. When I get to this area, I'm zeroing the cart and changing the status in the database to P . Currently the statuses are: A = Open, P = Payment and F = Finished (after confirmation of payment on return to the store in case the credit card changes to F ).

Only I went into detail. When the customer is in the payment part and the internet falls or the light is out, he will have to make the purchase process again, and the cart is empty with Status P and when he gets back to the payment part, he ends up accumulating the values and not creating a new purchase. This is exactly where I can not find a logical reasoning and need help in this reasoning.

When the customer after going through the processes of the virtual store and arriving at the payment part, how can I create a new purchase in case the customer wants to return to the store or something external happens without accumulating the values of the previous purchases? >     

asked by anonymous 21.08.2017 / 17:40

1 answer

1

I would particularly use a new table:

pedidos
   id_user
   id_product
   ...
   status

So when the user logs in, he checks to see if he has an order with pending status and places the items in his cart. I hope I have helped.

    
21.08.2017 / 18:33