Пример #1
0
 public function CheckInventory($data)
 {
     $updated_data = array();
     foreach ($data as $row => $val) {
         if ($val == 0) {
             $shop = new Model_Shop();
             $shop->removefromCart($row);
         } else {
             $check = $this->getData("Store", " ProductId =" . $row);
             if ($check[0]['Quantity'] < $val) {
                 $updated_data[$row] = 1;
                 setcookie("cart_item_qty[" . $row . "]", 1, time() + 3600, "/");
             } else {
                 $updated_data[$row] = $val;
                 setcookie("cart_item_qty[" . $row . "]", $val, time() + 3600, "/");
             }
         }
     }
     return $updated_data;
 }
Пример #2
0
 public function cartremoveAction()
 {
     if ($this->_getParam('rm')) {
         $product_id = $this->_getParam('rm');
         $shop = new Model_Shop();
         $shop->removefromCart($product_id);
     }
     $this->_redirect('/cart/');
 }