Jump to content

Recommended Posts

I started my shopping cart about a month ago , its something I have always wanted to do for education purposes. I have done the main parts.

I just need your input on how I would do the following.

 

When a user add a product to the cart this gets stored in table with a session id. When the users views the cart it looks something like this. I want to be able to store this information in a new table called OrdersComplete.

 

How would I do this?

The problem I am having is that everyone orders will be different. How can I take one chunk of information like this below, and store in a field on the database.

 

Crazy thing is I have managed to do everything else, its taken a month on and off and yet I get to the end and now I am stuck. I first thought of sticking this info in hidden fields but then again, this is fine if the table always had the same amount of fields and every order was the same, but it wont.

 

Your input would be greatly appreciated.

 

1 x NINETNDO WII £134.00

Colour: Green £0.00

Size: Small £2.50

 

6 x NINETNDO WII £134.00

Colour: Red £0.00

Size: Small £15.00

 

 

I misunderstood your question originally.

 

why not just make a table called complete, with customer id, body_text, date, whatever else you need.

 

then just save the data as a text feild as is.

 

 

other option could be to add each line as a row in your table. eg product/user id/order id. so an order could include 1 or 20 entries into the databse but the order id would link them all together.

 

 

I am rebuilding my cart, it seems I have backed myself in to a corner, and looking at the code and how it works, I am making something easy difficult.

 

For example I am adding up the product options on the cart page, I don't need to do this. I just need to get the total values of the product options and add these to the product price before inserting to the cart. The only math I need to do on the cart page is multipliy the amount of products by the cost for that product.

 

I have made some big mistakes.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.