Loading ...
Sorry, an error occurred while loading the content.

Shopping Cart

Expand Messages
  • rania2345
    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
    Message 1 of 2 , Apr 1, 2008
    • 0 Attachment
      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
    • Aman (আমান)
      there might be problem on how you are sending the ajax requests,, check and debug if the data is reached upto the class, what data is received by the class and
      Message 2 of 2 , Apr 1, 2008
      • 0 Attachment
        there might be problem on how you are sending the ajax requests,, check and debug if the data is reached
        upto the class, what data is received by the class and finally is the cart object actually got and saved from/to session.

        May all help all.
        --
        Shaikh Sonny Aman
        Trippert Labs
        www.mailtoaman.com

        Mobile : +8801556368534
        Fixed Phone: +88028915711
      Your message has been successfully submitted and would be delivered to recipients shortly.