adrian28uk Posted June 13, 2007 Share Posted June 13, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/55457-shopping-basket-nearly-complete-but-stuck-on-one-thing/ Share on other sites More sharing options...
adrian28uk Posted June 14, 2007 Author Share Posted June 14, 2007 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/55457-shopping-basket-nearly-complete-but-stuck-on-one-thing/#findComment-274673 Share on other sites More sharing options...
dj-kenpo Posted June 14, 2007 Share Posted June 14, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/55457-shopping-basket-nearly-complete-but-stuck-on-one-thing/#findComment-274687 Share on other sites More sharing options...
adrian28uk Posted June 14, 2007 Author Share Posted June 14, 2007 Thank you very very much. You have given me something to think about there. You know what its like, sometimes you can be stuck for hours sometimes days, but then you finally crack it the rewards are great. Quote Link to comment https://forums.phpfreaks.com/topic/55457-shopping-basket-nearly-complete-but-stuck-on-one-thing/#findComment-274824 Share on other sites More sharing options...
adrian28uk Posted June 15, 2007 Author Share Posted June 15, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/55457-shopping-basket-nearly-complete-but-stuck-on-one-thing/#findComment-275149 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.