I need to create a mini shopping cart.
So here is example of what I have. so please correct me if I need to change.
The product that is being sold is a service.
The service allow a user to have document reviewed.
I have created a form that user file out and upload documents for review. -this works-
I can create the code to check if user purchase before allowing access to this page.
how do build the tables this 3 or 4 tables I having problems with.
So here is what I have done.
My tables are:User, Roles, User_In_Roles. Doctors, Reviewers, Patients, Products, Order_Details, Carts.
When doctor log in user he have to purchase service from the cart in order to submit for review. I need to see how to connect the tables. How should products order_details, cart connects to the Patients and Doctors table.
Doctors purchases service product,code 5 from the product table. Click cart to pay. Every time a doctor submits a patients form to be reviewed it will be subtracted from the quantity value from the program he purchase.
This is my table connections:
product has a fk to doctors, order_details, patients and cart.
order_details has a fk to patients.
cart has a fk to patients and product.
My product table is this.
ProductId int PK
PatientsId int FK
DoctorsId int FK
Program string
price numeric
My Order_Details table
OrderDetailsId int PK
PatientsId Fk
ProductId FK
Quantity int
Price numeric
My Cart table is this
CartId int PK
PatientsId Fk
ProductId Fk
Count int
Please direct me on how to properly connect the tables.