Mojo Posted February 2, 2012 Share Posted February 2, 2012 I'm trying to setup a cart system for a photography website. Ideally, there would be a set of photos, with a dropdown box to select various sizes, and a box to input the quantity. And ideally, people could add different sizes of the same photo and it would show up as a seperate product in the cart. $_SESSION['cart'][$pid] = array ('qty' => $qty, 'product' => $product); That code works, except will just override the previous product. I need a unique session id or auto-incrementing ID so two products with the same print id can be added. Thanks for any help in advance! Link to comment Share on other sites More sharing options...
Larry Posted February 3, 2012 Share Posted February 3, 2012 If you have two products with the same print ID, how will you know how to fulfill the order? Every unique product you sell MUST have a unique ID. Link to comment Share on other sites More sharing options...
Mojo Posted February 3, 2012 Author Share Posted February 3, 2012 In that case, I would have to have the same picture repeat 10 times. Instead, I'd like to have a picture listed once, with a dropdown for different size options. I would know how to fulfil the order because the selection in the dropdown with the print size would be attached to the order with the print id for that photo. Another example: I want to sell a tshirt, but have different sizes available. I don't want to list the same tshirt 5 times - I want to list it once and allow a dropdown to select different sizes. Thanks Link to comment Share on other sites More sharing options...
Larry Posted February 3, 2012 Share Posted February 3, 2012 Right. That's the second example in the book, with coffee available in different sizes, grounds, and caf/decaf. Each variation gets a unique ID. Only by having unique IDs for each possible combination can you have a working shopping cart. Link to comment Share on other sites More sharing options...
Recommended Posts