本文整理汇总了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";
}
示例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);
}