D
D
Dmitry STEM2017-05-31 10:37:40
PHP
Dmitry STEM, 2017-05-31 10:37:40

How to make a shopping cart on a site selling keys?

I am writing a key store now. The customer wants a basket. I don't understand how to do it correctly... When buying, N lines are taken from the file with the game keys and this is entered into the table with orders (order id, buyer's email, game id in the store, keys, date of purchase, price).
How to make it possible to pay for several games with N keys in the basket at once and they are displayed in 1 order as several games?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry STEM, 2017-05-31
@STEM1

Like I figured it out. Create 2 tables:
orders (id, price, date, order_product, success)
order_product (id, id_product, price, order_id, keys)
When ordering, create 1 new order (in orders), and create all items from the cart separately by specifying id in order_id order created earlier and after that put the array of product id in order_product.

A
Anton Shamanov, 2017-05-31
@SilenceOfWinter

It's not entirely clear what the problem is. There is a table with game keys (game, key, owner) when buying / paying for the required number of records, the owner field is set.

S
Semyon Beloglazov, 2017-05-31
@Batlab

Look here

E
Emil Rakhmatullin, 2020-08-19
@Emchik

angry-cart.js as an option for FrontEnd :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question