Sorry for such a long post.
I'm building a shopping cart from scratch which will ultimately plug into Protx. I've built a few PHP/MySQL apps previously but not with 'da money' involved. I'm having echoes of Michael from 'Office Space' saying "I must have added an extra zero, I always do that".
Anyway, one part I'm confused over, I wonder how easy it is to store cart information, even when the user closes his/her browser. So when they come back and look in their cart, it still displays all the products added to the cart previously.
Should I be looking to cookies rather than sessions, or set a long timeout for my sessions?
For this cart/site, the user can add a number of products to his/her cart. Different types of one 'product', like a green car, red car or a red boat, blue boat etc. The 'car' being the product.
Should I be using sessions and arrays for storing the different products and their attributes? Each product will have some fairly detailed info with it, based on what the user submits the form, which will all just go into the title/description bit.
I just wanted to get the advice of the pro's here.
My idea for the SQL tables would be:
CUSTOMERS (username, password, email)
ORDERS(order_id, customer_id, total, order_date, approved)
ORDER_CONTENTS(oc_id, order_id, item_id, description, qty, price)
PRODUCTS (item_id, title, price)
And in terms of scripts, I was thinking:
cart.php - to display the current products in my cart (using session data)
update.php - change the quantity of products
add.php - adds items to my cart
remove.php - removes product from cart
checkout.php - takes all my cart/user data and sends it to Protx
Does this sound like a good procedure to start with?
Anything obvious I'm missing?
If anyone can give me one or two pointers for starting the 'add.php' and 'cart.php' I'd be eternally grateful.
Everything else should be fairly straightforward I guess .