Пример #1
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";
     }
 }
Пример #2
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";
     }
 }
Пример #3
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