コード例 #1
0
ファイル: themhang.php プロジェクト: phictd/hethongwebhai
    $qty = $_SESSION['cart'][$id] + 1;
} else {
    $qty = 1;
}
$_SESSION['cart'][$id] = $qty;
$ok = 1;
foreach ($_SESSION['cart'] as $k => $v) {
    if (isset($k)) {
        $ok = 2;
    }
}
if ($ok == 2) {
    $hang = new HangHoa();
    foreach ($_SESSION['cart'] as $key => $value) {
        $hang->set_idhang($key);
        $dataid[] = $hang->getHang();
    }
    foreach ($dataid as $data) {
        foreach ($data as $rowid) {
            $total += $_SESSION['cart'][$rowid['idHang']] * $rowid['Gia'];
        }
    }
    $items = $_SESSION['cart'];
    $_SESSION['thanhtien'] = number_format($total);
    $_SESSION['tongmathang'] = count($items);
    echo $_SESSION['tongmathang'] . " Mặt hàng <br />";
    echo "<span id='border_cart'></span>";
    echo "Tổng: <span id='price'>" . $_SESSION['thanhtien'] . " VND</span>";
} else {
    echo '0';
}
コード例 #2
0
ファイル: chitiet.php プロジェクト: phictd/hethongwebhai
<?php 
ini_set("display_errors", 0);
require_once 'libraries/hanghoa.php';
$id = $_GET['id'];
$b = new HangHoa();
$b->set_idhang($id);
$data1 = $b->getHang();
?>
<style >
#chitiet
{
width:600px;
border: 1px solid #c6dbef;
margin:0px 0px 0px 20px;

}
#chitiet h1
{
    font-size: 15px;
    background: #f7f3f7;
    height: 25px;
    padding:5px;
    border-bottom: 1px solid #c6dbef;
    line-height: 25px;
    color:#ff0000;
}
#khung
{
    overflow: hidden;
    margin:15px 0px 0px 0px;
}