示例#1
0
<?php

include_once "Brain/field_const.php";
include_once "Brain/User.php";
include "header1.php";
?>
<link href="css/register.css" rel="stylesheet" type="text/css" />
<script src='js/register.js'> </script>
<?php 
include "Brain/District.php";
include "Brain/UserControl.php";
include "header2.php";
include_once "Brain/ShoppingCart.php";
$cart = new SCart();
if (isset($_GET["error"])) {
    echo "<script> alert('Sorry, we only delivery two day after order.')</script>";
}
if (UserControl::checkState() && UserControl::getType() == 'c') {
    $cust = getCustomer(getInfo(UserControl::getUserNo())[ID]);
    if (isset($_POST[distNo], $_POST[custAddr], $_POST["sdate"])) {
        $date = strtotime($_POST["sdate"]);
        $minday = strtotime(date("Y-m-d", strtotime("+ 2 days")));
        if ($date < $minday) {
            header("Location: checkout.php?error=true");
        } else {
            if ($cart->checkout($_POST["sdate"], "100", $_POST[custAddr], $cust[custNo], $_POST[distNo])) {
                header("Location: shoppingcart.php?sucess=true");
            } else {
                echo "<script> alert('Sorry!');</script>";
            }
        }
示例#2
0
include "header1.php";
?>
<link rel="stylesheet" type="text/css" href="css/products.css" />
<link rel="stylesheet" type="text/css" href="css/products-m.css" />
<script src="scripts/products.js"></script>
<?php 
include "header2.php";
error_reporting(0);
include_once "Brain/field_const.php";
include_once "Brain/functions.php";
include_once "Brain/Product.php";
include_once "Brain/Category.php";
include_once "Brain/User.php";
include_once "Brain/ShoppingCart.php";
regGet('prodName', 'priceMin', 'priceMax', 'catNo');
$cart = new SCart();
if ($prodName == "") {
    $prodName = null;
}
if ($priceMin == "") {
    $priceMin = null;
}
if ($priceMax == "") {
    $priceMax = null;
}
if ($catNo == "") {
    $catNo = null;
}
$prods = getProducts($prodName, $priceMin, $priceMax, null, null, $catNo, null);
//$prods = getAllProducts();
?>
示例#3
0
<?php

include_once "Brain/ShoppingCart.php";
$cart = new SCart();
if (isset($_POST["removeID"])) {
    $cart->removeItem($_POST["removeID"]);
    echo "Removed";
    return;
} else {
    if (isset($_POST["getTotalAmount"])) {
        printf("%.02f", $cart->getTotalAmount());
        return;
    }
}
echo "<html>";
include "header1.php";
?>

	<script src="jquery_ui/external/jquery/jquery.js"></script>
	<link rel="stylesheet" type='text/css' href='jquery_ui/dataTable/jquery.dataTables.min.css'/>	
	<script src="jquery_ui/dataTable/jquery.dataTables.min.js"></script>		
	<link rel="stylesheet" href="jquery_ui/jquery-ui.min.css">
	<link rel="stylesheet" href="css/shoppingCart.css">
	<script src='js/shoppingCart.js'></script>
<?php 
include "header2.php";
if (isset($_GET["sucess"])) {
    echo "<script> alert('Thank You!');</script>";
}
?>
<body>
示例#4
0
error_reporting(0);
include_once "../Brain/field_const.php";
include_once "../Brain/functions.php";
include_once "../Brain/ShoppingCart.php";
include_once "../Brain/Product.php";
include_once "../Brain/UserControl.php";
if (!UserControl::checkState()) {
    echo "Error: You must login first!";
    return;
}
regGet('act', 'prodNo', 'qty');
if (!isset($act) || !isset($prodNo)) {
    echo "Error: No action specified";
    return;
}
$cart = new SCart();
$prod = getProduct($prodNo);
//$cart->clear();
if ($act == 'add') {
    if (!isset($qty)) {
        $qty = 1;
    }
    $cart->addProduct($prodNo, $prod[prodPrice], $qty);
    //if not success
    //...
} else {
    $cart->removeItem($prodNo);
}
$cartProds = $cart->getProducts();
//var_dump($cartProds);
echo SCart::genCartMenuHtml($cartProds);
示例#5
0
				<div><a class="navIcon"s>Orders</a></div>
			</div>
			<?php 
}
?>
			<?php 
if (UserControl::getType() == 'c') {
    ?>
			<div class="navTab navCart col-10 col-m-20">
				<div>
					<span class="fa fa-2x fa-shopping-cart cartIcon navIcon" onclick="window.location='shoppingCart.php'"></span>
					<div class="cartMenu">
						<ul>
							<?php 
    include_once "Brain/ShoppingCart.php";
    $cart = new SCart();
    $html = SCart::genCartMenuHtml($cart->getProducts());
    echo $html;
    ?>
						</ul>
						<button onclick="window.location='shoppingCart.php'">VIEW CART</button>
					</div>
				</div>
			</div>
			<?php 
}
?>
			<div class="navTab col-10 col-m-20">
				<div><span class="fa fa-2x fa-search userIcon navIcon" onclick="showSearchBar()"></span></div>
			</div>
			<div class="navTab col-10 col-m-20">