I have a working shopping cart which adds items to the sessions like so:
Code: Select all
// CHECK IF A PRODUCT IS BEING ADDED TO THE BASKET
if($_GET['action']=='add' || isset($_GET['id'])){
//GET THE PRODUCT ID
$id = $_GET['id'];
//IF THE ITEM IS ALREADY IN THE CART - JUST ADD 1 TO QTY
if(isset($_SESSION['cart'][$id])){
$_SESSION['cart'][$id]++;
//REDIRECT TO CART ONCE ADDED
Header("Location: /dnp/cart/");
ob_end_flush();
} else {
//IF IT ISN@T IN THE CART, JUST ADD IT ONCE
$_SESSION['cart'][$id] = 1;
//REDIRECT TO CART ONCE ADDED
Header("Location: /dnp/cart/");
ob_end_flush();
}
}
id name description price
My question is how can i add options. For instance colours sizes, and the price may change depending on the options.
Probably need a new table which is fine - if someone could detail how to do this i would be ever so greatful!
I look forward to your replies!!
Thanks