Hi all
I store details of my shopping basket into an array when the user types a quantity and colour required of a product and then hits the submit button. My array is as follows:
$_SESSION['cart'][$productid] = array('quantity' => $_POST['quantity'], 'productprice' => $productprice, 'productsize' => $productsize,'productcolour' => $_POST['selectedcolour']);
And then I list the items form the array in my basket as such:
foreach ($_SESSION['cart'] as $k => $v) {
// do stuff here
}
However I have just come across a problem in that, I need to be able to allow the user to go back to the product page and select a different colour/quantity combination and this be ADDED to the basket rather than updating the exisiting record in the array. I think this is because I am using the [$productid] as the key of the array.
How would I get round this without having to re-code much of my work that loops through the array etc?
Thanks for reading.