session_start(); } include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/PhotoManager.php"; $productMgr = new ProductManager(); $photoMgr = new PhotoManager(); $userid = null; $username = null; if (isset($_SESSION["userid"]) && !empty($_SESSION["userid"])) { // $userid is customer email address $userid = $_SESSION["userid"]; $pos = strpos($userid, "@"); // $username is displayed in the header $username = substr($userid, 0, $pos); $cart_items = $productMgr->retrieveFromShoppingCart($userid); $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid); } ?> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"> <link rel="stylesheet" href="./public_html/css/main.css"> <link rel="stylesheet" href="./public_html/css/webShop.css"> <link href="//vjs.zencdn.net/4.12/video-js.css" rel="stylesheet"> <style> body{ background-color:#EBEBEB;
include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; // define the filter type chosen before sort if any $changed_item_id = addslashes(filter_input(INPUT_POST, 'changed_item_id')); $qty_to_change = $_POST["qty_to_change"]; $customer_id = addslashes(filter_input(INPUT_POST, 'customer_id')); $color = addslashes(filter_input(INPUT_POST, 'color')); $productMgr = new ProductManager(); $stock = $productMgr->getStock($changed_item_id); $data_form = array(); if ($stock >= $qty_to_change) { $productMgr->updateItemQty($customer_id, $color, $changed_item_id, $qty_to_change); $stock = $productMgr->getStock($changed_item_id); $subtotal = 0; $shipping_fee = 0; $cart_items = $productMgr->retrieveFromShoppingCart($customer_id); foreach ($cart_items as $each_cart_product) { $each_cart_item_id = $each_cart_product['product_id']; $each_cart_item_name = $productMgr->getProductName($each_cart_item_id); $each_cart_item_price = $productMgr->getPrice($each_cart_item_id); $each_cart_item_qty = $each_cart_product['quantity']; $each_cart_item_total = $each_cart_item_price * $each_cart_item_qty; $subtotal += $each_cart_item_total; } if ($subtotal > 100) { $shipping_fee = 0; } else { $shipping_fee = 5; } $total = $shipping_fee + $subtotal; $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($customer_id);