Hello
I am struggling with Restaurant Shopping Cart
Basically , onclick on the Add to cart , it add the food item to
$_Session['cart'] has $foodid, $qty
I am using ajax, to send the $foodid to the server then Get all the
Groups from the data base for this item . each Groups has a drop down
list of options , once the customer select option I need to send it to
ajax and send the option value to the server , assosiate all options
which is item
forexample
Early Breakfast has 5options (bread, butter,cheese,coffee,milk)
my Session['cart'] now has only the item id , early Breakfast,
I am not able to add those options from the drop down menu to the
session['cart']
here is my shopping cart class
class Shopping_Cart {
private $cart;
function __construct($cart="") {
$this->cart = $cart;
}
function getCart() {
return $this->cart;
}
function addToCart($item) {
if(isset($this->cart[$item])) {
$this->cart[$item]++;
} else {
$this->cart[$item] = 1;
}
}
function updateCart($item,$number) {
$this->cart[$item] = $number;
}
function deleteFromCart($item) {
if(isset($this->cart[$item])) {
// $this->cart[$item]--;
//if($this->cart[$item] == 0) {
$this->cart[$item] == 0;
unset($this->cart[$item]);
//}
}
}
Thanks
God Bless you
Rania