Esempio n. 1
0
    public static function viewCart()
    {
        ?>
		<div class="container viewCart">
		<div class="cartTitle">Shopping Cart</div>
			<!-- Headers for the cart -->
			<div class="row">
			  <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
			  	<div class="cartProductName">Product Name</div>
			  </div>
			  <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
			  	<div class="cartProductPrice">Product Price</div>
			  </div>
			  <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
			  	<div class="cartProductQuantity">Quantity</div><br>
			  </div>
			</div>
			<hr class="cartSep">
			<!-- Products in cart -->
			<div class="row">
			  <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
			  	<div class="cartProductName"><?php 
        getUserData::shoppingCartProductName(1);
        ?>
</div>
			  </div>
			  <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
			  	<div class="cartProductPrice"><?php 
        getUserData::shoppingCartProductPrice(1);
        ?>
</div>
			  </div>
			  <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
			  	<div class="cartProductQuantity"><?php 
        getUserData::shoppingCartProductQuantity(1);
        ?>
</div><br>
			  </div>
			</div>
			<hr class="cartSep">
			<div class="row">
				<div class="col-lg-5 col-md-2 col-sm-3 col-xs-4">
					<a class="btn btn-warning btn-md contBtn1 shoppingCartOrder" href="placeOrder">Order Now</a>
				</div>
				<div class="col-lg-5 col-md-7 col-sm-5 col-xs-0">
				</div>
				<div class="col-lg-2 col-md-3 col-sm-4 col-xs-8">
					<div class="cartInfo">Items(<?php 
        getUserData::getCartNumOfItems();
        ?>
):<?php 
        getUserData::getCartTotal();
        ?>
</div>
				</div>
			</div>
		</div>
		<?php 
    }
Esempio n. 2
0
 public static function getCartContents()
 {
     if (isset($_SESSION['numOfCartItems'])) {
         if ($_SESSION['numOfCartItems'] > 0) {
             if (isset($_SESSION['cart'])) {
                 //creates an array with the count of every key. Great function!
                 $numArray = array_count_values($_SESSION['cart']);
                 getUserData::convertIdToItem($numArray);
             }
         } else {
             echo "Cart is empty";
         }
     } else {
         echo "Cart is empty";
     }
 }
Esempio n. 3
0
 public static function shoppingCartProductQuantity($htmlFlag = 0)
 {
     if (isset($_SESSION['numOfCartItems'])) {
         if ($_SESSION['numOfCartItems'] > 0) {
             if (isset($_SESSION['cart'])) {
                 //creates an array with the count of every key. Great function!
                 $numArray = array_count_values($_SESSION['cart']);
                 //calls the function below with html flag to output <br> instead of newlines.
                 if ($htmlFlag) {
                     getUserData::convertIdToItem($numArray, 0, 4);
                 } else {
                     //getUserData::convertIdToItem($numArray);
                 }
             } else {
                 echo "Cart is empty";
             }
         } else {
             echo "Cart is empty";
         }
     } else {
         echo "Cart is empty";
     }
 }
Esempio n. 4
0
    public static function show()
    {
        session_start();
        ?>

<!DOCTYPE html>
<html lang="en">
<head>
<title>Pool Shop</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" href="assets/style.css" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="iecss.css" />
<![endif]-->
<script type="text/javascript" src="assets/js/boxOver.js"></script>
</head>
<body>
<div id="main_container">
  <div id="header">
    <div id="logo"> <a href=""><img src="assets/images/logo.png" alt="" border="0" width="182" height="85" /></a> </div>
    <div class="big_banner"> <a href="home"><img src="" alt="" border="0" /></a> </div>
  </div>
  <div id="main_content">
    <div id="menu_tab">
      <ul class="menu">
        <li><a href="home" class="nav"> Home </a></li>
        <li class="divider"></li>
        <li><a href="products" class="nav">Products</a></li>
        <li class="divider"></li>
        <li><a href="specials" class="nav">Specials</a></li>
        <li class="divider"></li>
        <li><a href="myaccount" class="nav">My account</a></li>
        <li class="divider"></li>
        <li><a href="signup" class="nav">Sign Up</a></li>
        <li class="divider"></li>
        <li><a href="placeOrder" class="nav">Place Order</a></li>
        <li class="divider"></li>
        <li><a href="contact" class="nav">Contact Us</a></li>
        <li class="divider"></li>
        <li><a href="about" class="nav">About</a></li>
        <?php 
        if (isset($_SESSION['user_session'])) {
            ?>
        <li class="divider"></li>
        <li><a href="models/logoutUser.php" class="logout">Logout</a></li>
        <?php 
        }
        ?>
        <li><span class="welcomeMsg"><?php 
        if (isset($_SESSION['user_session'])) {
            echo "Welcome";
        }
        ?>
</span></li>
        <li><span class="welcomeUser"><?php 
        if (isset($_SESSION['user_session'])) {
            echo strtoupper($_SESSION['firstName']);
        }
        ?>
</span></li>
      </ul>
      
    </div>
    <!-- end of menu tab -->
    <div class="crumb_navigation"> Navigation: <span class="current">Home</span> </div>
    <div class="left_content">
      <div class="title_box"><a class="title_box" href="categories">Categories</a></div>
      <ul class="left_menu">
        <li class="odd"><a href="chemicals">Chemicals</a></li>
        <li class="even"><a href="equipment">Equipment</a></li>
        <li class="odd"><a href="accessories">Accessories</a></li>
        <li class="even"><a href="hottubs">Hot Tubs</a></li>
        <li class="odd"><a href="pools">Pools</a></li>
        <li class="even"><a href="poolfloats">Pool Floats</a></li>
        <li class="odd"><a href="hardwareparts">Hardware and Parts</a></li>
      </ul>
      <div class="title_box">Special Products</div>
      <div class="border_box">
        <div class="product_title"><a href="showProduct?productId=1">Chlorine Tablets</a></div>
        <div class="product_img"><a href="showProduct?productId=1"><img src="assets/images/testImg.png" alt="" border="1"  /></a></div>
        <div class="prod_price"><span class="reduce">$350</span> <span class="price">$50.49</span></div>
      </div>
      <div class="title_box"><a class="title_box" href="newsletter">Newsletter</a></div>
      <div class="border_box">
      	<form action="models/subscribeUser.php" method="POST">
        <input type="email" name="newsletter" class="newsletter_input" placeholder="Subscribe for deals!" required/>
        <input type="submit" value="Subscribe"> </form><span><?php 
        if (isset($_SESSION['flag'])) {
            if ($_SESSION['flag'] == 1) {
                echo "<span class='emailSuccess'>Thanks for subscribing!</span>";
            }
            if ($_SESSION['flag'] == 2) {
                echo "<span class='emailError'>That email is already subscribed</span>";
            }
            unset($_SESSION['flag']);
        }
        ?>
</span> </div>
      
      <div class="banner_adds"> <a href="contact"><img src="assets/images/callUsBanner.png" alt="" border="0" /></a> </div>
    </div>
    <!-- end of left content -->
    <!-- end of center content -->
    <div class="right_content">
      <div class="title_box">Search</div>
      <div class="border_box">
        <input type="text" name="search" class="newsletter_input" placeholder="keyword"/>
        <a href="search" class="join">search</a> </div>
      <div class="shopping_cart">
        <div class="title_box"><a class ="title_box" href="cart">Shopping Cart</a></div>
        <div class="cart_details"><?php 
        getUserData::getCartNumOfItems();
        ?>
 items <br />
          <span class="border_cart"></span> Total: <span class="price"><?php 
        getUserData::getCartTotal();
        ?>
</span> </div>
        <div class="cart_icon"><a href="cart"><img src="assets/images/shoppingcart.png" alt="" width="35" height="35" border="0" /></a></div>
      </div>
      <div class="title_box">What's new</div>
      <div class="border_box">
        <div class="product_title"><a href="showProduct?productId=2">Pool Shade</a></div>
        <div class="product_img"><a href="showProduct?productId=2"><img src="assets/images/poolShade.jpg" width="80" height="80" border="1" alt="" border="0" /></a></div>
        <div class="prod_price"><span class="reduce">$35</span> <span class="price">$9.99</span></div>
      </div>
      <div class="title_box">Manufacturers</div>
      <ul class="left_menu">
        <li class="odd"><a href="">Manufacturer1</a></li>
        <li class="even"><a href="">Manufacturer2</a></li>
        <li class="odd"><a href="">Manufacturer3</a></li>
        <li class="even"><a href="">Manufacturer4</a></li>
        <li class="odd"><a href="">Manufacturer5</a></li>
        <li class="even"><a href="">Manufacturer6</a></li>
        <li class="odd"><a href="">Manufacturer7</a></li>
        <li class="even"><a href="">Manufacturer8</a></li>
      </ul>
      <?php 
        if (!isset($_SESSION['user_session'])) {
            ?>
      			<br><div class="title_box">Login</div><br>
      			<form action="models/loginUser.php" method="POST">
      			<input type="email" name="emailLogin" value="" placeholder="Email" required>
      			<input class="loginPass" type="password" name="passLogin" value="" placeholder="Password" required>
      			<input class="loginButton" type="submit" value="Login">
      			</form>
      <?php 
        } else {
            ?>
      			<br><div class="title_box logoutBox">Logout</div><br>
      			<form action="models/logoutUser.php" method="POST">
      			<input class="logoutButton" type="submit" value="Logout">
      			</form>
      <?php 
        }
        if (isset($_SESSION['loginError'])) {
            echo "<span class='loginError'>Invalid email/password.</span><br>";
            unset($_SESSION['loginError']);
        }
        ?>
      <div class="banner_adds"> <a href=""><img src="" alt="" border="0" /></a> </div>
    </div>
    <!-- end of right content -->
  </div>
  <!-- end of main content -->
  <div class="footer">
    <div class="left_footer"> <img src="assets/images/footer_logo.png" alt="" width="89" height="42"/> </div>
    <div class="center_footer"> PoolWebsite. All Rights Reserved 2015<br /><br>
      <img src="assets/images/payment.gif" alt="" /> </div>
    <div class="right_footer"> <a href="home">home</a> <a href="about">about</a> <a href="contact">contact us</a> <a href="suggestions">suggestions</a> </div>
  </div>
</div>
<!-- end of main_container -->
</body>
</html>


 <?php 
    }
Esempio n. 5
0
 //Who to send to, Subject, Body
 sendEmail::EmailStore("*****@*****.**", "New Order", $output);
 //Start the second email function for the customers email
 ob_start();
 //Email title/header
 echo "Online Order Details:\n";
 //Get all the details for the email body
 echo "First Name = " . $_POST['firstNameOrder'] . "\n";
 echo "Last Name = " . $_POST['lastNameOrder'] . "\n";
 echo "Email = " . $_POST['emailOrder'] . "\n";
 echo "Phone = " . $_POST['phoneNumberOrder'] . "\n";
 echo "Order Notes = " . $_POST['orderNotes'] . "\n";
 echo "Items: \n";
 $numArray = array_count_values($_SESSION['cart']);
 //Get the carts contents
 getUserData::convertIdToItem($numArray, false);
 //Echo the total of the order
 echo "Total = \$" . $_SESSION['cartTotal'];
 //Get all the contents from the output buffer
 $output = ob_get_clean();
 //Sanitize the string just in case
 $output = filter_var($output, FILTER_SANITIZE_STRING);
 //Email the customer
 sendEmail::EmailCustomer($_POST['emailOrder'], "Order Confirmation", $output);
 /**
  * This next segment of code creates the order in the database.  The order in
  * the database will be handled through an Admin console which I will eventually
  * build.  Orders are for record keeping and such.  Save inventory decrementing to 
  * the admin console just in case an order is not picked up.
  */
 //get connection
Esempio n. 6
0
    public static function show()
    {
        //Check if user is logged in. If so prefill the forms.
        if (isset($_SESSION['user_session'])) {
            //get db connection
            $dbh = Database::getDB();
            $getUserInfo = $dbh->prepare("SELECT uid, email, firstName, lastName, phoneNumber \r\n\t\t\t\t\t\t\t\t\t\t  FROM users WHERE email=:email");
            //Bind the values
            $getUserInfo->bindParam(':email', $_SESSION['user_session'], PDO::PARAM_STR);
            //execute
            $getUserInfo->execute();
            //Fetch the row to see if it exists
            $userInfo = $getUserInfo->fetch(PDO::FETCH_ASSOC);
            Database::clearDB();
        }
        ?>
	<script>
	function clicked(e)
	{
	    if(!confirm('Are you ready to order?'))e.preventDefault();
	}
	</script>
	<div class="row">
	<div class="wrapperCustom">
	<div class="col-lg-12">
		 <div class="backgroundHeader">
		  	<h1 class="aboutHeading">Place Order</h1><br><br>
		  </div>
	  </div>
	 <div class="col-lg-3 col-md-3 col-sm-2 col-xs-0"></div>
	 <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12 orderContent">
		<form action="models/placeOrder.php" method="POST">
		<div class="loginForm">
			<div>
				<span class="orderTitle">First name</span><br>
				<input class="orderInput" type="text" name="firstNameOrder" placeholder="First Name" maxlength="40" required value="<?php 
        if (isset($userInfo['firstName'])) {
            echo $userInfo['firstName'];
        }
        ?>
" pattern="[a-zA-Z-]{1,40}" title="Please enter a valid first name">
			</div>
			<br>
			<div>
				<span class="orderTitle">Last name</span><br>
				<input class="orderInput" type="text" name="lastNameOrder" placeholder="Last Name" maxlength="40" required value="<?php 
        if (isset($userInfo['lastName'])) {
            echo $userInfo['lastName'];
        }
        ?>
" pattern="[a-zA-Z-]{1,40}" title="Please enter a valid last name">
			</div>
			<br>
			<div>
				<span class="orderTitle">Email</span><br>
				<input class="orderInput" type="email" name="emailOrder" placeholder="Email Address" maxlength="50" required value="<?php 
        if (isset($userInfo['email'])) {
            echo $userInfo['email'];
        }
        ?>
" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" title="Please enter a valid email">
			</div>
			<br>
			<div>
				<span class="orderTitle">Phone Number</span><br>
				<input class="orderInput" type="tel" name="phoneNumberOrder" maxlength="20" placeholder="Phone Number" required value="<?php 
        if (isset($userInfo['phoneNumber'])) {
            echo $userInfo['phoneNumber'];
        }
        ?>
" pattern="[0-9-]{7,}" title="Please enter a valid phone number. Ex) 210-123-4567">
			</div>
			<br>
			<div>
				<span class="orderTitle">Item List *Pulled From Your Cart*</span><br>
				<textarea readonly class="orderList2"><?php 
        getUserData::getCartContents();
        ?>
</textarea>
				
				
			</div>
			<br>
			<div>
				<span class="orderTitle">Order Notes</span><br>
				<textarea rows="4" cols="50" name="orderNotes" class="orderInputTextBox"></textarea>
			</div>
			<br><br>
			<input class="orderSubmit" type="submit" value="Submit" <?php 
        if (isset($_SESSION['numOfCartItems'])) {
            if ($_SESSION['numOfCartItems'] == 0) {
                echo "disabled";
            }
        } else {
            echo "disabled";
        }
        ?>
 onclick="clicked(event)">
		</div>
	  </form>
	<span id="orderWarning">Please allow at least 30 minutes for order to be completed before picking up.</span><br><br><br>
	<span id="onlineOrderWarning">*****Online Ordering Coming Soon*****</span>
	</div>
	<div class="col-lg-3 col-md-3 col-sm-2 col-xs-0"></div>
	</div>
	</div>
<?php 
        //sendEmail::Email();
    }