Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql tables for shopping cart

Status
Not open for further replies.

spyderco

Programmer
Jan 23, 2005
107
US
Sorry for cross posting. I thought about it and thought I'd be better to be asked here since it is programmed in Perl.

I am still quite new with MySQL and need some help getting the basic setup.

I am creating a mini shopping cart and I need some help to make sure I am getting the tables correct. There are 4 tables.

Code:
---------     ---------
|products|    | temp  |
---------     ---------
id            id
name          zip
desc          email
price         userid
weight        shiprice
shipinfo      subtotal
              total
              coupon
              ip

-----------     -----------
|temporder|     |order    |
-----------     -----------
id              id
???             userid
                subtotal
                total
                shipcost
                shipmethod
                name, address, zip, phone, etc..
I have one table for all the products. One temp table which puts their CURRENT order into while they are surfing the site. The order table pulls the information out of the temp table once the order was verified via PayPal's IPN. The temporder table I have no idea what to do with.
I am lost as to how to add all the user's products and qty's to a table without making a new table for each person. That seems very, very costly but I don't know any other way to do it. I need the current items and quantities in both the temporder and the order table (or somehow related so I can pull it back later).

I could in reality make an order table and make duplicate USERID rows and have items/quantities that way and just search for rows that have the USERID in question. This means more reasonable than a new table but depending on the database size, could be costly as well.

Does anyone know of a simple way to add their items/qty's to the table(s)?

In reality, I have no idea how to add the products to the order or temp database. How do I record every product someone purchases? I am so lost.

Any help would be MUCH appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top