Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

e-Commerce and placing an order with multiple items

Topic Labels: Base design
Solved
Jump to Solution
274 1
cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

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: