//Check for shopping cart cookie from user if(!isset($_COOKIE['3DmyCart'])){ // if a cookie does not exist, set it for 3 days (86400 = 1 day) $thisSession = session_id(); setcookie("3DmyCart", $thisSession, mktime()+259200, "/") or die("Could not set cookie"); }else{ // if a cookie already exists session_destroy(); session_id($_COOKIE['3DmyCart']); session_name("3Dcart"); session_start(); } //-------> //Set vars $Sid = session_id(); $curTime = date('Y-m-d H:i:s'); $grand_total = 0; $message=""; //-------> // Connect to database include('secure/e_mysqli_connect.html'); //-------> //message set? if(isset($_GET['m'])){ $m=$_GET['m']; if (!is_numeric ($m)){ header("location:index.html"); }else{ if($m==1){ $message = "
Item Removed From Cart!
"; }elseif($m==2){ $message = "Item Qty Updated!
"; } } } //-------> ?>NOTE: To remove an item from your cart, simply change the qty to 0 and click 'Update Qty'.
"; while($cartrow = $cartResult->fetch_assoc()){ $cart_item_id = $cartrow['prod_id']; $cart_item_qty = $cartrow['qty']; //calculate total for cart $priceSql = "SELECT prod_num, prod_name, prod_price FROM products WHERE prod_id = '$cart_item_id'"; $priceResult = mysqli_query($con, $priceSql) or die(mysqli_error($con)); while($pricerow = $priceResult->fetch_assoc()){ $cart_item_num = $pricerow['prod_num']; $cart_item_name = $pricerow['prod_name']; $cart_item_price = $pricerow['prod_price']; $cart_item_total=($cart_item_price*$cart_item_qty); $show_cart_item_total=number_format($cart_item_total, 2); $grand_total = ($grand_total+$cart_item_total); //create product row echo" "; //-------> } } //create grand total row $grand_total=number_format($grand_total, 2); echo"Cart Total: $".$grand_total.""; //-------> echo"NOTE:We ship via USPS priority Mail. Shipping cost will be billed seperately at our actual cost.
Please contact us if you have any questions about shipping or want to know what it will cost to ship your order.
"; }else{ //cart is empty echo"Your Cart is Empty!
"; } //-------> ?>