Example #1
0
// or body of the page depends of action which come
// from probably GET or POST
// category list will be shown in most cases
// default action is browsing default category
// default category is defined in constants.php
switch ($action) {
    case 'detail':
        showCategories($mode);
        showDetail($ASIN, $mode);
        break;
    case 'addtocart':
    case 'deletefromcart':
    case 'emptycart':
    case 'showcart':
        echo "<hr /><h1>Your shopping cart</h1>";
        showCart($_SESSION['cart'], $mode);
        break;
    case 'image':
        showCategories($mode);
        echo "<h1>Large Product Image</h1>";
        showImage($ASIN, $mode);
        break;
    case 'search':
        showCategories($mode);
        echo "<h1>Search Results For " . $search . "</h1>";
        showSearch($search, $page, $mode);
        break;
    case 'browsenode':
    default:
        showCategories($mode);
        $category = getCategoryName($browseNode);
Example #2
0
</div>

<div class="lightbox_content cart">
<div class="lightbox_close"><img src="img/closeicon.png" alt="Close About" /></div>
    <div class="lightbox_info">
    	<h1>
        Shopping Cart 
        (<?php 
echo count($cart) > '0' ? count($cart) : '0';
?>
 items added)
		</h1>
        
		<div class="textwrapper cart">
			<?php 
showCart($cart);
?>
		</div>
        
        <div class="checkout">
        	<form action="checkout.php" method="post">
            <p>Your total price is: $<?php 
echo number_format($totalCart / 100, 2, '.', '');
?>
</p>
            	<button type="submit" name="finish" value="checkout" class="btn checkout">Checkout</button>
            </form>
        </div>
    </div>
</div>
Example #3
0
                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="cart.php" id = "whiteText">Cart</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" id = "whiteText">Account <span class="caret"></span></a>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="logOutRedirect.php">Logout</a></li>
                                <li class="divider"></li>
                                <li><a href="settings.php">Account</a></li>
                            </ul>
                        </li>
                    </ul>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>

        <div class="container well">
            <table class="table table-striped">
                <? showCart() ?>
            </table>
            <button id="checkOutBtn" type="button" class="btn btn-info" onclick="checkout()">Checkout</button>
        </div>

        <p class = "one"></p>
		<div class="pull-right">
			<h4>&copy;Blue Store&nbsp;&nbsp;&nbsp;&nbsp;</h4>
		</div>
    </body>
<script type="text/javascript" src="scripts/script.js"></script>
</html>
Example #4
0
<head>
	<title>PHP Shopping Cart Demo &#0183; Cart</title>
	<link rel="stylesheet" href="css/styles.css" />
</head>

<body>

<div id="shoppingcart">

<h1>Your Shopping Cart</h1>

<?php 
echo writeShoppingCart();
?>

</div>

<div id="contents">

<h1>Please check quantities...</h1>

<?php 
echo showCart();
?>

<p><a href="index.php">Back to bookshop...</a></p>

</div>

</body>
</html>
                        $prefix = "p-";
                    }
                    for ($i = 0; $i < $qty; $i++) {
                        if ($newcart) {
                            $newcart .= ',' . $prefix . $id;
                        } else {
                            $newcart = $prefix . $id;
                        }
                    }
                }
            }
            $_SESSION[$user . 'cart'] = $newcart;
        } else {
            if ($action == "reloadShoppingCart") {
                cleanCart();
                $shoppingcart = showCart();
                $preview = writeShoppingCart();
                $cartpreview = writeCartPreview();
                $result = array('cart' => $shoppingcart, 'preview' => $preview, 'cartpreview' => $cartpreview, 'session' => $cart);
                echo json_encode($result);
            }
        }
    }
}
function deleteItem($id, $cart)
{
    $items = explode(',', $cart);
    $newcart = '';
    foreach ($items as $item) {
        if ($id != $item) {
            if ($newcart != '') {
    $HTTP_SESSION_VARS['cart'] = array();
}
// show top bar
require_once 'topbar.php';
// main event loop.  Reacts to user action on the calling page
switch ($action) {
    case 'detail':
        showCategories($mode);
        showDetail($ASIN, $mode);
        break;
    case 'addtocart':
    case 'deletefromcart':
    case 'emptycart':
    case 'showcart':
        echo '<hr /><h1>Your Shopping Cart</h1>';
        showCart($HTTP_SESSION_VARS['cart'], $mode);
        break;
    case 'image':
        showCategories($mode);
        echo '<h1>Large Product Image</h1>';
        showImage($ASIN, $mode);
        break;
    case 'search':
        showCategories($mode);
        echo "<h1>Search Results For '{$search}'</h1>";
        showSearch($search, $page, $mode);
        break;
    case 'browsenode':
    default:
        showCategories($mode);
        $category = getCategoryName($browseNode);
Example #7
0
<?php

require_once "nnekagigiheader.php";
require_once "functions.php";
showCart();
require_once "nnekafooter.php";
Example #8
0
    if (isset($_POST["emptycart"])) {
        $_SESSION["cart"] = "";
        //session_destroy();    //kill all sessions
        unset($_SESSION["cart"]);
        //netter, alleen cart wordt leeggemaakt
    }
    if (isset($_POST["afrekenen"])) {
        echo "<div id='pagina'>Bedankt voor het bestllen bij pizza Soprans. Uw betaling is gereed.</div>";
        exit;
    }
}
//check cart session
$cart = array();
if (isset($_SESSION["cart"])) {
    $cart = $_SESSION["cart"];
}
//check order
if (isset($_POST["pizza"]) && isset($_POST["size"]) && isset($_POST["aantal"])) {
    $pizza = $_POST["pizza"];
    $size = $_POST["size"];
    $aantal = $_POST["aantal"];
    $price = $pizzas[$pizza][$size];
    //get price from input array
    //make order as array
    $order = array($pizza, $size, $aantal, $price * $aantal, 0);
    //1 = default voor aantal
    $_SESSION["cart"] = addOrderToCart($cart, $order);
    $html .= showCart($_SESSION["cart"]);
}
echo $html;
//echo(showPizzaArray($pizzas));
Example #9
0
            }
            $output[] = '<tr  style="background-color:#CCCCCC;font-weight:bold;height:23px">';
            $output[] = '<td style="padding-left:10px" colspan="4"><b>Tổng đơn giá:</b> <font color=#FF0000><strong>' . number_format($total, 0, ",", ".") . ' VND</strong></font></td>';
            $output[] = '</tr>';
            $output[] = '</table>';
        } else {
            $output[] = '<p>You shopping cart is empty.</p>';
        }
        return join('', $output);
    }
    ?>
<table  align="center" width="750" border="0" bordercolor="#bbbbbb" cellpadding="1" cellspacing="1" >

<tr >
      <td  colspan="2" ><?php 
    echo showCart($_GET['view']);
    ?>
</td>
<tr >
      <td  colspan="2" height="30" >
</td>	    
</tr> </table>



 <?php 
    $sqlstr = mysql_query("SELECT * FROM " . shoppingCart . " WHERE id=" . intval($view) . "");
    mysql_query("UPDATE " . shoppingCart . " SET status='true' WHERE id=" . intval($view) . "");
    if (mysql_num_rows($sqlstr) > 0) {
        $row = mysql_fetch_array($sqlstr);
        ?>