app/Cart.php
/*
      * update product quantity in the cart
      */
update product quantity in the cart
update product quantity in the cart
public function updateQty($id, $qty)
    {
        $this->totalQuantity -= $this->items[$id]['qty'];
        $this->totalPrice -= $this->items[$id]['price'] * $this->items[$id]['qty'];
        $this->items[$id]['qty']  = $qty;
        $this->totalQuantity += $qty;
        $this->totalPrice += $this->items[$id]['price'] * $qty;
    }
public function updateQty ( $ id , $ qty ) { $ this -> totalQuantity -= $ this -> items [ $ id ] [ 'qty' ] ; $ this -> totalPrice -= $ this -> items [ $ id ] [ 'price' ] * $ this -> items [ $ id ] [ 'qty' ] ; $ this -> items [ $ id ] [ 'qty' ] = $ qty ; $ this -> totalQuantity += $ qty ; $ this -> totalPrice += $ this -> items [ $ id ] [ 'price' ] * $ qty ; }
update product quantity in the cart
update product quantity in the cart
//        reset qty and price in the cart //         add the item with the new quantity