Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE>
- <?php
- error_reporting(E_ERROR | E_PARSE);
- session_start();
- include("functions/functions.php");
- ?>
- <html>
- <head>
- <title>Oklisya Shop</title>
- <link rel="stylesheet" href="styles/style.css" media="all" />
- </head>
- <body>
- <!--Main Container starts here-->
- <div class="main_wrapper">
- <!--Header starts here-->
- <div class="header_wrapper">
- <img id="banner" src="images/hhhhh.png" />
- <img id="logo" src="images/logo.png" />
- </div>
- <!--Header ends here-->
- <!--Navigation Bar starts-->
- <!--Navigation Bar ends-->
- <!--Content wrapper starts-->
- <div class="content_wrapper">
- <?php cart(); ?>
- <div id="shopping_cart">
- <span style="float:center; font-size:18px; padding:5px; line-height:50px;">
- <?php
- if(isset($_SESSION['customer_email'])){
- echo "<b>Welcome : </b>" . $_SESSION['customer_email'] . "<b style='color:orange;'> Your</b>" ;
- }
- else {
- echo "<b> Welcome to the Store</b>";
- }
- ?>
- <b style="color:orange">Shopping cart:</b>
- Total Items: <?php @$_SESSION['t_item'] ?>
- Total Price: Rp.<?php echo @$_SESSION['tagihan'] ?>,-
- <a href="index.php" style="color:yellow">Back to Shop</a>
- <?php
- if(!isset($_SESSION['customer_email'])){
- echo "<a href='checkout.php' style='color:white;'>Login</a>";
- }
- else {
- echo "<a href='logout.php' style='color:white;'>Logout</a>";
- }
- ?>
- </span>
- </div>
- <div id="sidebar">
- <div id="form">
- <form method="get" action="results.php" enctype="multipart/form-data">
- <input type="text" name="user_query" placeholder="search a product" />
- <input type="submit" name="search" value="search"/>
- </form>
- </div>
- <div id="sidebar_title">categories</div>
- <ul id="cats">
- <?php getCats(); ?>
- </ul>
- </div>
- <div id="content_area">
- <ul id="menu">
- <li><a href="index.php">Home</a></li>
- <li><a href="all_products.php">All Product</a></li>
- <li><a href="#">My Account</a></li>
- <li><a href="#">Sign up</a></li>
- <li><a href="#">Shopping Cart</a></li>
- </ul>
- <div id="products_box">
- <form action="" method="post" enctype="multipart/form-data">
- <table align="center" width="700" bgcolor="skyblue">
- <tr align="center">
- <th>Remove</th>
- <th>Product (s)</th>
- <th>Quantity</th>
- <th>Price</th>
- <th>Total Price</th>
- </tr>
- <?php
- $total = 0;
- $t_item = 0;
- global $con;
- $ip = getIp();
- $sel_price = "select * from cart where ipadd='$ip'";
- $run_price = mysqli_query($con, $sel_price);
- $c = 0;
- while($p_price=mysqli_fetch_array($run_price)){
- $pro_id = $c = $p_price['proid'];
- $pro_price = "select * from products where product_id='$pro_id'";
- $run_pro_price = mysqli_query($con,$pro_price);
- while ($pp_price = mysqli_fetch_array($run_pro_price)){
- $product_price = array($pp_price['product_price']);
- $product_title = $pp_price['product_title'];
- $product_image = $pp_price['product_image'];
- $single_price = $pp_price['product_price'];
- $values = array_sum($product_price);
- $total += $values;
- ?>
- <tr align="center">
- <td><input type="checkbox" name="remove[]" value="<?php echo $pro_id;?>"/></td>
- <td><?php echo $product_title; ?><br>
- <img src="admin_area/product_images/<?php echo $product_image;?>" width="60" height="60"/>
- </td>
- <td>
- <input type="text" size="4" name=<?php echo 'qty_'.$c ?>
- value="<?php echo @$_SESSION['qty_'.$c];?>"/>
- </td>
- <?php
- if(isset($_POST['update_cart'])){
- @$qty = $_POST['qty'.$c];
- @$update_qty = "update cart set qty='$qty'"; // where ????
- $run_qty = mysqli_query($con, $update_qty);
- $_SESSION['qty'.$c]= $qty;
- $total = $total*$qty;
- }
- ?>
- <td><?php echo "Rp " . @$single_price . ",-"; ?></td>
- <td><?php echo "Rp " . @$single_price*@$qty . ",-"; ?></td>
- <?php @$t_item += $qty;?>
- </tr>
- <?php }
- @$subtotal += @$single_price*@$qty;
- $_SESSION["tagihan"] = $subtotal;
- $_SESSION["t_item"] += $t_item;
- $c += 1;} ?>
- <tr align="center">
- <td colspan="3"></td>
- <td><b>Sub Total:<b></td>
- <td><?php echo "Rp " . @$subtotal.',-'; ?></td>
- </tr>
- <tr align="center">
- <td colspan="2"><input type="submit" name="update_cart" value="Update Cart"/></td>
- <td><input type="submit" name="lanjut" value="Continue Shopping" /></td>
- <td><a href="checkout.php" style="text-decoration:none; color:black">
- <button type="button">Checkout</button></a></td>
- </tr>
- </table>
- </form>
- <?php
- global $con;
- $ip = getIp();
- if(isset($_POST['update_cart'])){
- foreach(@$_POST['remove'] as $remove_id){
- $delete_product = "delete from cart where proid='$remove_id' AND ipadd='$ip'";
- @$run_delete = mysqli_query($con, $delete_product);
- if($run_delete){
- echo "<script>window.open('cart.php','_self')</script>";
- }
- }
- }
- if(isset($_POST['lanjut'])){
- echo "<script>window.open('index.php','_self')</script>";
- }
- ?>
- </div>
- </div>
- </div>
- <!--Content Wrapper ends-->
- <div id="footer">
- <h2 style="text-align:center; padding-top:30px;">© 2016 by www.OklisyaShop.com</h2>
- </div>
- </div>
- <!--Main Container ends here-->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement