示例#1
0
文件: cart.php 项目: anton-kol/buelo
    }
    ?>
            <tr style="background: #ffffa5;">
                <td colspan="5" align="right" style="padding: 5px;">
                    <b><span id="cartsum"><?php 
    echo $sum;
    ?>
</span> MDL</b>
                </td>
                <Td style="width: 20px;">
                </td>
            </tr>
        </table><br />

        <?php 
    if (getCartCount() > 0) {
        ?>
            <form action="/?l=p&p=cart&act=sendorder" method="POST" id="sendform">
                <?php 
        echo T_OrderComment;
        ?>
:
                <textarea name="comment" id="comment"></textarea>
                <input type="submit" class="btn" style="float: right; margin-right: 10px;" value="<?php 
        echo T_SendOrder;
        ?>
">
            </form>
        <?php 
    }
    ?>
示例#2
0
<link rel="stylesheet" href="../css/style3.css">
<link rel="stylesheet" href="../css/bootstrap.css">


<p><?php 
echo getCartCount();
?>
  items in cart</p>

<?php 
if (isset($allCategories)) {
    ?>
<center>
    <table class="table table-striped">
        <thead>
                <tr> 
    <?php 
    foreach ($allCategories as $row) {
        ?>
                    <th>All Categories:</th>
                    <td><a href="?cat=<?php 
        echo $row['category_id'];
        ?>
"><?php 
        echo $row['category'];
        ?>
</a></td>
                       
                </tr>
        </thead>
示例#3
0
switch ($_GET['go']) {
    case 'addtocart':
        $query = mysql_query("SELECT id FROM orders WHERE user_id = '" . $user['id'] . "' AND status = 0");
        if ($res = mysql_fetch_array($query)) {
            $orderID = $res['id'];
        } else {
            mysql_query("INSERT INTO orders (user_id,status) VALUES ('" . $user['id'] . "', '0')");
            $orderID = mysql_insert_id();
        }
        $query = mysql_query("SELECT price FROM prices WHERE product_id = '" . $_POST['productID'] . "' AND pt_id = '" . $user['pt_id'] . "'");
        $res = mysql_fetch_array($query);
        $price = (double) $res['price'];
        $quant = $_POST['quantity'] == '0' ? 1 : $_POST['quantity'];
        $query = mysql_query("SELECT cart.id AS line FROM cart LEFT JOIN orders ON cart.order_id = orders.id WHERE orders.id = '" . $orderID . "' AND cart.product_id = '" . $_POST['productID'] . "'");
        if ($cartLine = mysql_fetch_array($query)) {
            mysql_query("UPDATE cart SET quantity = '" . $quant . "', price = '" . $price . "' WHERE id = '" . $cartLine['line'] . "'");
        } else {
            mysql_query("INSERT INTO cart (product_id,quantity,price,order_id) VALUES ('" . $_POST['productID'] . "','" . $quant . "','" . $price . "','" . $orderID . "')");
        }
        echo '{"incart" : "' . getCartCount() . '"}';
        break;
    case "updatecart":
        mysql_query("UPDATE cart SET quantity = '" . $_POST['quantity'] . "' WHERE id = '" . $_POST['cartline'] . "'");
        break;
    case "deleteline":
        mysql_query("DELETE FROM cart WHERE id = '" . $_POST['cartline'] . "'");
        break;
    case "deletephoto":
        mysql_query("UPDATE products_photo SET hidden = 1 WHERE id = '" . $_POST['imgid'] . "'");
        break;
}