示例#1
0
文件: cart.php 项目: qiushuiqs/myshop
            //根据ID删除购物车中的商品
            $goods_id = $_GET['goods_id'];
            if ($cartObj->removeItem($goods_id) == false) {
                $msg = "You can not delete the Item which was not in the cart<br>";
                include __ROOT__ . 'view/front/msg.html';
                exit;
            }
        }
    }
}
$items = $cartObj->getAllItems();
if (empty($items)) {
    header('Location: index.php');
    exit;
}
$items = $goods->goodsByCart($items);
$numOfGoods = $cartObj->getItemCount();
$t_shopprice = $cartObj->getPrice();
//算出市场总价
$t_mktprice = 0;
foreach ($items as $item) {
    $t_mktprice += $item['market_price'] * $item['num'];
}
$discount = $t_mktprice - $t_shopprice;
$discount_prc = floor((int) $discount / $t_mktprice * 100);
//$_SESSION['t_shopprice'] = $t_shopprice;
if ($act == 'checkout') {
    include __ROOT__ . 'view/front/tijiao.html';
    exit;
}
include __ROOT__ . 'view/front/jiesuan.html';