} if (isset($_POST["curType"])) { $type = $_POST["curType"]; $id = $_POST["curId"]; if ($type == "addToOrder") { } else { if (isset($mcart)) { $mcart->OperateCart($id, $type); } } } if (isset($_POST["btnCart"])) { $hat_id = $_POST["hat_id"]; $sql = "select * from hat where hat_id='" . $hat_id . "'"; $hatservice = new HatService(); $list = $hatservice->GetRows($sql); if ($list) { $hat = new Hat(); $hat->HatId = $list[0]["hat_id"]; $hat->HatName = $list[0]["hat_title"]; $hat->Price = $list[0]["hat_price"]; $hat->ImgUrl = $list[0]["hat_path"]; $hat->Quantity = 1; if (isset($mcart)) { $mcart->AddHat($hat); } else { $mcart = new MyCart(); $mcart->AddHat($hat); $_SESSION[constant("SESSION_CART")] = $mcart; } }
<script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/ddsmoothmenu.js"></script> </head> <body> <?php $nav = ""; if (isset($_GET["logout"])) { if (isset($_SESSION["customer"])) { unset($_SESSION["customer"]); } } global $hats; $sql = "select * from hat"; $service = new HatService(); $hats = $service->GetRows($sql); ?> <div id="body_wrapper"> <div id="wrapper"> <?php include_once 'Header.php'; ?> <div id="main"> <?php include_once 'Category.php'; ?> <div id="content" class="float_r"> <h1>All Products</h1> <?php if ($hats) { foreach ($hats as $hat) {
<script type="text/javascript" src="../js/Common.js"></script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/ddsmoothmenu.js"></script> </head> <body> <div id="body_wrapper"> <div id="wrapper"> <?php if (isset($_GET["hatId"])) { $hatId = $_GET["hatId"]; $service = new HatService(); $sql = "select h.hat_id,h.hat_path,h.hat_description,h.hat_price,c.category_title,h.hat_title,c.category_id, "; $sql .= " (select group_concat( t.supplier_name ) from (select m.map_hat_id, s.supplier_name from map_hat_supplier m, supplier s where m.map_supplier_id = s.supplier_id ) t where t.map_hat_id =h.hat_id) as suppliers "; $sql .= " from hat h, category c where h.hat_category_id = c.category_id and hat_id='" . $hatId . "'"; $rows = $service->GetRows($sql); global $hat; $hat = $rows[0]; $nav = "> <a href='DisplayCategory.php?cateName=" . urlencode($hat["category_title"]) . "&cateId=" . urlencode($hat["category_id"]) . "'>" . $hat["category_title"] . "</a>"; $nav .= "> <span>" . $hat["hat_title"] . "</span>"; } include_once 'Header.php'; ?> <div id="main"> <?php include_once 'Category.php'; ?> <form id="form1" action="MyCart.php" method="post"> <div id="content" class="float_r"> <h3>Hat Detail</h3>