<?php include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; // define the filter type chosen before sort if any $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>
<?php include_once 'classes/Checkout.class.php'; include_once 'classes/ProductManager.class.php'; $Checkout = new Checkout(); $ProductManager = new ProductManager(); // Add the product to our basket $Checkout->addToBasket($ProductManager->getProduct($_POST['code'])); header("Location: index.php");
$userid = null; $username = null; if (!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); } $checkoutList = $_POST; $productMgr = new ProductManager(); $photoMgr = new PhotoManager(); $list = []; //var_dump($checkoutList); foreach ($checkoutList as $checkout) { $product = $productMgr->getProduct($checkout["productId"]); $item = []; $photoList = $photoMgr->getPhotos($product["product_id"]); $item["product_id"] = $product["product_id"]; $item["product_name"] = $product["product_name"]; $item["color"] = $checkout["color"]; $item["thumbnail"] = $photoList[$item["color"]]; $item["quantity"] = $checkout["quantity"]; $item["price"] = $product["price"]; $item["subtotal"] = $checkout["quantity"] * $product["price"]; $item["add_to_cart_time"] = $checkout["create_time"]; array_push($list, $item); } include_once "./templates/header2.php"; $creditMgr = new CreditManager(); $creditList = $creditMgr->getUnusedCreditListByReceiverId($userid);