Help

Re: e-Commerce and placing an order with multiple items

Solved
Jump to Solution
981 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Saas_Uxstone
4 - Data Explorer
4 - Data Explorer

Hello everyone!
I need to implement order creation in e-commerce. So, I have a “Products” table and an “Orders” table. The “Orders” table has a “Selected Products” field that is linked to the “Products” table. When a user selects a product, the link is implemented and all data from the “Products” is provided in the “Orders table”.

There is such a case when the user must select the quantity for each product, and the total amount must be calculated accordingly. However, I have no idea how to bind each quantity for each product that is taken from “Products” table. Can you give any suggestions to solve this problem?

The architecture looks like this:
Table “Orders”: fields “Selected Products”: Product1, Product 2 [links]; “Total Amount”, “Quantities” (Here user needs to enter for Product1 and Product 2); “Price” (from “Products”)

Table “Products”: fields “Name”, “Quantity”, “Price”

Total amount = price[0] * quantities[0] + price[1] * quantities[1] (I need such formula)

1 Solution

Accepted Solutions
Kamille_Parks
16 - Uranus
16 - Uranus

You need a junction table. Instead of linking products directly to orders, you need a “Line Items” table that links to orders and products and contains a field for quantity. See this template for an example:

See Solution in Thread

1 Reply 1
Kamille_Parks
16 - Uranus
16 - Uranus

You need a junction table. Instead of linking products directly to orders, you need a “Line Items” table that links to orders and products and contains a field for quantity. See this template for an example: