Ejemplo n.º 1
0
$qty = intval(addslashes(filter_input(INPUT_POST, 'qty')));
//$url = filter_input(INPUT_POST, 'url');
//print_r($url);
$stock = $productMgr->getStock($product_id);
session_start();
$userid = null;
$addedQty = 0;
$totalQty = 0;
$qty_update = false;
$cart_data = array();
if (!empty($_SESSION["userid"])) {
    // $userid is customer email address
    $userid = $_SESSION["userid"];
    $cart_data['error_not_logged_in'] = false;
    //add product to the shopping cart
    if ($productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color) > 0) {
        $addedQty = $productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color);
        $totalQty = $addedQty + $qty;
        $productMgr->updateItemQty($userid, $color, $product_id, $totalQty);
        $qty_update = true;
    } else {
        $productMgr->addProductToShoppingCart($userid, $product_id, $qty, $color);
    }
    $photoList = $photoMgr->getPhotos($product_id);
    $photo_url = $photoList[$color];
    //get the number of item in customer's shopping cart
    $cart_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid);
    $cart_unique_qty = $productMgr->retrieveTotalNumberOfUniqueItemsInShoppingCart($userid);
    $item_qty = $productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color);
    $product_name = $productMgr->getProductName($product_id);
    $cart_data['cart_qty'] = $cart_qty;
Ejemplo n.º 2
0
$selected_product_id = addslashes(filter_input(INPUT_POST, 'selected_product_id'));
$customer_id = addslashes(filter_input(INPUT_POST, 'customer_id'));
$productMgr = new ProductManager();
$product_selected = $productMgr->getProduct($selected_product_id);
$selected_product_name = $product_selected['product_name'];
$selected_product_description = $product_selected['description'];
$selected_product_price = $product_selected['price'];
$selected_product_stock = $product_selected['stock'];
$selected_product_qty_id = $selected_product_id . 'qty';
$selected_qty_msg_id = $selected_product_id . 'msg';
$selected_add_btn_id = $selected_product_id . 'btn';
//if the customer is not logged in, the default quantity of product in the cart is 0
$selected_product_in_cart = 0;
//if customer is logged in, check if the product is in the cart
if (!empty($customer_id)) {
    $selected_product_in_cart = $productMgr->retrieveItemQtyInShoppingCart($customer_id, $selected_product_id);
}
?>
    
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="text-danger fa fa-times"></i></button>
              <h4 class="modal-title" id="myModalLabel"><i class="text-muted"></i> <?php 
echo $selected_product_name;
?>
 </h4>
            </div>
            
            <div class="modal-body" style="height:500px;width:800px">
               <div>
                    <div style="float:left">
                        <div class="productImgBig" style="width:367px;height:367px;border:1px solid #BDBDBD;margin-bottom:10px">
Ejemplo n.º 3
0
    $customerMgr->activateAccount($email);
    $_SESSION["userid"] = $email;
    $form_data['status'] = 'success';
    $form_data['message'] = "";
    //Add credit to the new signed-up account if there is credit sender information in session
    if (isset($_COOKIE["sender_email"])) {
        $sender_email = $_COOKIE["sender_email"];
        $creditMgr->addCredit($sender_email, $email);
        $customerMgr->updateCredit($email, 10.0);
        $form_data['status'] = 'success';
        $form_data['message'] = "Congratulations! You have got \$10 credits from your friend!";
        setcookie('sender_email', '', time() - 1);
    }
    //    Add cart item in temporary status into the cart of new signed-up account
    if (isset($_SESSION['temp_product_id_to_cart']) && !empty($_SESSION['temp_product_id_to_cart'])) {
        if ($productMgr->retrieveItemQtyInShoppingCart($userid, $_SESSION['temp_product_id_to_cart']) > 0) {
            $addedQty = $productMgr->retrieveItemQtyInShoppingCart($userid, $_SESSION['temp_product_id_to_cart']);
            $totalQty = $addedQty + $_SESSION['temp_product_qty_to_cart'];
            $productMgr->updateItemQty($userid, $_SESSION['temp_product_id_to_cart'], $totalQty);
        } else {
            $productMgr->addProductToShoppingCart($userid, $_SESSION['temp_product_id_to_cart'], $_SESSION['temp_product_qty_to_cart']);
        }
        unset($_SESSION['temp_product_id_to_cart']);
        unset($_SESSION['temp_product_qty_to_cart']);
    }
    if ($form_data['message'] != "") {
        header('location: index.php?status=' . $form_data['status'] . '&message=' . $form_data['message']);
    } else {
        header('location: index.php?');
    }
} else {
Ejemplo n.º 4
0
$selected_product_name = $product_selected['product_name'];
$selected_product_description = $product_selected['description'];
$selected_product_price = $product_selected['price'];
$selected_product_stock = $product_selected['stock'];
$selected_product_qty_id = $selected_product_id . 'qty';
$selected_qty_msg_id = $selected_product_id . 'msg';
$selected_add_btn_id = $selected_product_id . 'btn';
//if the customer is not logged in, the default quantity of product in the cart is 0
$selected_product_in_cart = 0;
//if customer is logged in, check if the product is in the cart
$selected_product_photoList = $photoMgr->getPhotos($selected_product_id);
$selected_product_colorStr = $productMgr->getColor($selected_product_id);
$selected_product_colorList = explode(",", $selected_product_colorStr);
$color = !empty($selected_product_color) ? $selected_product_color : $selected_product_colorList[0];
if (!empty($userid)) {
    $selected_product_in_cart = $productMgr->retrieveItemQtyInShoppingCart($userid, $selected_product_id, $color);
}
?>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="./public_html/css/bootstrap.min.css">
    <link rel="stylesheet" href="./public_html/font-awesome-4.1.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="./public_html/css/main.css">
    <link rel="stylesheet" href="./public_html/css/webShop.css">
    <script src="./public_html/js/jquery-1.11.0.js"></script>
    <script src="./public_html/js/bootstrap.min.js"></script> 
    <script>
    function ScaleImage(srcwidth, srcheight, targetwidth, targetheight, fLetterBox) {

        var result = { width: 0, height: 0, fScaleToTargetWidth: true };