include_once "../Brain/field_const.php"; include_once "../Brain/functions.php"; include_once "../Brain/ShoppingCart.php"; include_once "../Brain/Product.php"; include_once "../Brain/UserControl.php"; if (!UserControl::checkState()) { echo "Error: You must login first!"; return; } regGet('act', 'prodNo', 'qty'); if (!isset($act) || !isset($prodNo)) { echo "Error: No action specified"; return; } $cart = new SCart(); $prod = getProduct($prodNo); //$cart->clear(); if ($act == 'add') { if (!isset($qty)) { $qty = 1; } $cart->addProduct($prodNo, $prod[prodPrice], $qty); //if not success //... } else { $cart->removeItem($prodNo); } $cartProds = $cart->getProducts(); //var_dump($cartProds); echo SCart::genCartMenuHtml($cartProds);
</div> <?php } ?> <?php if (UserControl::getType() == 'c') { ?> <div class="navTab navCart col-10 col-m-20"> <div> <span class="fa fa-2x fa-shopping-cart cartIcon navIcon" onclick="window.location='shoppingCart.php'"></span> <div class="cartMenu"> <ul> <?php include_once "Brain/ShoppingCart.php"; $cart = new SCart(); $html = SCart::genCartMenuHtml($cart->getProducts()); echo $html; ?> </ul> <button onclick="window.location='shoppingCart.php'">VIEW CART</button> </div> </div> </div> <?php } ?> <div class="navTab col-10 col-m-20"> <div><span class="fa fa-2x fa-search userIcon navIcon" onclick="showSearchBar()"></span></div> </div> <div class="navTab col-10 col-m-20">