當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ShoppingCart::deleteItem方法代碼示例

本文整理匯總了PHP中ShoppingCart::deleteItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP ShoppingCart::deleteItem方法的具體用法?PHP ShoppingCart::deleteItem怎麽用?PHP ShoppingCart::deleteItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ShoppingCart的用法示例。


在下文中一共展示了ShoppingCart::deleteItem方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     //        echo "This is Home Controller Index";
     //        echo":value ";
     $editItem = new Session('editItem');
     //var_dump($_SESSION);
     if (!empty($editItem->data)) {
         $itemId = $editItem->data[0];
         $shoppingCart = new ShoppingCart();
         $shoppingCart->deleteItem($itemId);
         $editItem->emptySession();
         // echo "edit item has been delete";
     }
     $getfilmInfo = new TopRateModel();
     $filmInfo = $getfilmInfo->getFilmInfo();
     $filmRate = $getfilmInfo->topRate();
     //var_dump($filmInfo);
     require_once "./View/HomePage1.php";
 }
開發者ID:zhaoyiyi,項目名稱:php-project,代碼行數:19,代碼來源:HomePageController.php

示例2: deleteItems

 /**
  * when customer click delete button delete order and update database
  *
  * @param $item_id
  */
 public function deleteItems($item_id)
 {
     //echo $item_id;
     $grandPrice = 0;
     $cart = new ShoppingCart();
     $filmBooking = new FilmBookingModel();
     $item = $cart->getItemById($item_id);
     $seats = explode(" ", $item->Seats);
     foreach ($seats as $seat) {
         $sql = "UPDATE seats\n                       SET available='Y'\n                       WHERE Room_ID=:Room_ID AND Run_Time=:Run_Time AND Seat_Name=:Seat_Name";
         $param = ["Room_ID" => $item->Room_ID, "Run_Time" => $item->Run_Time, "Seat_Name" => $seat];
         $filmBooking->updateSeats($param, $sql);
     }
     $cart->deleteItem($item_id);
     ///////////////////////////////////
     foreach ($cart->shoppingCart->data as $item) {
         $grandPrice += $item->TotalPrice;
     }
     $totalPrice = new Session('grandPrice');
     $totalPrice->emptySession();
     $totalPrice->data[] = $grandPrice;
     echo json_encode($cart->shoppingCart->data);
 }
開發者ID:zhaoyiyi,項目名稱:php-project,代碼行數:28,代碼來源:DetailController.php


注:本文中的ShoppingCart::deleteItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。