How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.

 How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.How to create a ecommerce website in php .Easy learn create dynamic website for shoping.




//// dbConfig.php

<?php 

// Database configuration 

$dbHost     = "localhost"; 

$dbUsername = "root"; 

$dbPassword = ""; 

$dbName     = "shop"; 

 

// Create database connection 

$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName); 

 

// Check connection 

if ($db->connect_error) { 

    die("Connection failed: " . $db->connect_error); 

}

?>

///////////////  index.php

////// 


<?php 

// Initialize shopping cart class 

include_once 'Cart.class.php'; 

$cart = new Cart; 

 

// Include the database config file 

require_once 'dbConfig.php'; 

?>


<!DOCTYPE html>

<html lang="en">

<head>

<title>PHP Shopping Cart</title>

<meta charset="utf-8">


<!-- Bootstrap core CSS -->

<link href="css/bootstrap.min.css" rel="stylesheet">


<!-- Custom style -->

<link href="css/style.css" rel="stylesheet">


</head>

</head>

<body>

<div class="container">

    <h1>PRODUCTS</h1>

    <!-- Cart basket -->

    <div class="cart-view">

        <a href="viewCart.php" title="View Cart"><i class="icart"></i> (<?php echo ($cart->total_items() > 0)?$cart->total_items().' Items':'Empty'; ?>)</a>

    </div>

    

    <!-- Product list -->

    <div class="row col-lg-12">

        <?php 

        // Get products from database 

        $result = $db->query("SELECT * FROM products ORDER BY id DESC LIMIT 10"); 

        if($result->num_rows > 0){  

            while($row = $result->fetch_assoc()){ 

        ?>

        <div class="card col-lg-4">

            <div class="card-body">

                <h5 class="card-title"><?php echo $row["name"]; ?></h5>

                <h6 class="card-subtitle mb-2 text-muted">Price: <?php echo '$'.$row["price"].' USD'; ?></h6>

                <p class="card-text"><?php echo $row["description"]; ?></p>

                <a href="cartAction.php?action=addToCart&id=<?php echo $row["id"]; ?>" class="btn btn-primary">Add to Cart</a>

            </div>

        </div>

        <?php } }else{ ?>

        <p>Product(s) not found.....</p>

        <?php } ?>

    </div>

</div>

</body>

</html>

////////////////   viewCart.php

<?php 

// Initialize shopping cart class 

include_once 'Cart.class.php'; 

$cart = new Cart; 

?>


<!DOCTYPE html>

<html lang="en">

<head>

<title>View Cart - PHP Shopping Cart</title>

<meta charset="utf-8">


<!-- Bootstrap core CSS -->

<link href="css/bootstrap.min.css" rel="stylesheet">


<!-- Custom style -->

<link href="css/style.css" rel="stylesheet">


<!-- jQuery library -->

<script src="js/jquery.min.js"></script>



</head>

<body>

<div class="container">

    <h1>SHOPPING CART</h1>

    <div class="row">

        <div class="cart">

            <div class="col-12">

                <div class="table-responsive">

                    <table class="table table-striped">

                        <thead>

                            <tr>

                                <th width="45%">Product</th>

                                <th width="10%">Price</th>

                                <th width="15%">Quantity</th>

                                <th class="text-right" width="20%">Total</th>

                                <th width="10%"> </th>

                            </tr>

                        </thead>

                        <tbody>

                            <?php 

                            if($cart->total_items() > 0){ 

                                // Get cart items from session 

                                $cartItems = $cart->contents(); 

                                foreach($cartItems as $item){ 

                            ?>

                            <tr>

                                <td><?php echo $item["name"]; ?></td>

                                <td><?php echo '$'.$item["price"].' USD'; ?></td>

                                <td><input class="form-control" type="number" id="hhddhdh"  value="<?php echo $item["qty"]; ?>" ></td>

                                <td class="text-right"><?php echo '$'.$item["subtotal"].' USD'; ?></td>

                                  <td class="text-right"><button class="btn btn-sm btn-primary" onclick="updateCartItem('<?php echo $item["rowid"]; ?>')">Update</button></td>

                                <td class="text-right"><button class="btn btn-sm btn-danger" onclick="return confirm('Are you sure?')?window.location.href='cartAction.php?action=removeCartItem&id=<?php echo $item["rowid"]; ?>':false;"><i class="itrash"></i> </button> </td>

                            </tr>

                            <?php } }else{ ?>

                            <tr><td colspan="5"><p>Your cart is empty.....</p></td>

                            <?php } ?>

                            <?php if($cart->total_items() > 0){ ?>

                            <tr>

                                <td></td>

                                <td></td>

                                <td><strong>Cart Total</strong></td>

                                <td class="text-right"><strong><?php echo '$'.$cart->total().' USD'; ?></strong></td>

                                <td></td>

                            </tr>

                            <?php } ?>

                        </tbody>

                    </table>

                </div>

            </div>

            <div class="col mb-2">

                <div class="row">

                    <div class="col-sm-12  col-md-6">

                        <a href="index.php" class="btn btn-block btn-light">Continue Shopping</a>

                    </div>

                    <div class="col-sm-12 col-md-6 text-right">

                        <?php if($cart->total_items() > 0){ ?>

                        <a href="checkout.php" class="btn btn-lg btn-block btn-primary">Checkout</a>

                        <?php } ?>

                    </div>

                </div>

            </div>

        </div>

    </div>

</div>

<script>

function updateCartItem(id){

     var qty=$("#hhddhdh").val();

    $.get("cartAction.php", {action:"updateCartItem", id:id, qty:qty}, function(data){

        window.location.reload();

        if(data == 'ok'){

            location.reload();

        }else{

          //  alert('Cart update failed, please try again.');

        }

    });

}

</script>

<script>

    //function updateCartItem(id){

        //alert(id);

       

        //alert(hhddhdh);

       // var ggg=$(".qty").val();

           // alert(ggg);

         //  $.ajax({

          //  url:'cartAction.php',

           // type:'get',

           // data:{id:id,qty:qty},

            //success:function(data){

//alert(data);

//console.log(data);

          //  }


         // });

    //}

    </script>

</body>

</html>


///////////////////////////////// Cart.class.php


<?php 

// Start session 

if(!session_id()){ 

    session_start(); 

 

/** 

 * Shopping Cart Class 

 * 

 * @package        PHP Library 

 * @category    Shopping Cart 

 * @author        CodexWorld Dev Team 

 * @link        https://www.codexworld.com 

 */ 

class Cart { 

    protected $cart_contents = array(); 

     

    public function __construct(){ 

        // get the shopping cart array from the session 

        $this->cart_contents = !empty($_SESSION['cart_contents'])?$_SESSION['cart_contents']:NULL; 

        if ($this->cart_contents === NULL){ 

            // set some base values 

            $this->cart_contents = array('cart_total' => 0, 'total_items' => 0); 

        } 

    } 

     

    /** 

     * Cart Contents: Returns the entire cart array 

     * @param    bool 

     * @return    array 

     */ 

    public function contents(){ 

        // rearrange the newest first 

        $cart = array_reverse($this->cart_contents); 

 

        // remove these so they don't create a problem when showing the cart table 

        unset($cart['total_items']); 

        unset($cart['cart_total']); 

 

        return $cart; 

    } 

     

    /** 

     * Get cart item: Returns a specific cart item details 

     * @param    string    $row_id 

     * @return    array 

     */ 

    public function get_item($row_id){ 

        return (in_array($row_id, array('total_items', 'cart_total'), TRUE) OR ! isset($this->cart_contents[$row_id])) 

            ? FALSE 

            : $this->cart_contents[$row_id]; 

    } 

     

    /** 

     * Total Items: Returns the total item count 

     * @return    int 

     */ 

    public function total_items(){ 

        return $this->cart_contents['total_items']; 

    } 

     

    /** 

     * Cart Total: Returns the total price 

     * @return    int 

     */ 

    public function total(){ 

        return $this->cart_contents['cart_total']; 

    } 

     

    /** 

     * Insert items into the cart and save it to the session 

     * @param    array 

     * @return    bool 

     */ 

    public function insert($item = array()){ 

        if(!is_array($item) OR count($item) === 0){ 

            return FALSE; 

        }else{ 

            if(!isset($item['id'], $item['name'], $item['price'], $item['qty'])){ 

                return FALSE; 

            }else{ 

                /* 

                 * Insert Item 

                 */ 

                // prep the quantity 

                $item['qty'] = (float) $item['qty']; 

                if($item['qty'] == 0){ 

                    return FALSE; 

                } 

                // prep the price 

                $item['price'] = (float) $item['price']; 

                // create a unique identifier for the item being inserted into the cart 

                $rowid = md5($item['id']); 

                // get quantity if it's already there and add it on 

                $old_qty = isset($this->cart_contents[$rowid]['qty']) ? (int) $this->cart_contents[$rowid]['qty'] : 0; 

                // re-create the entry with unique identifier and updated quantity 

                $item['rowid'] = $rowid; 

                $item['qty'] += $old_qty; 

                $this->cart_contents[$rowid] = $item; 

                 

                // save Cart Item 

                if($this->save_cart()){ 

                    return isset($rowid) ? $rowid : TRUE; 

                }else{ 

                    return FALSE; 

                } 

            } 

        } 

    } 

     

    /** 

     * Update the cart 

     * @param    array 

     * @return    bool 

     */ 

    public function update($item = array()){ 

        if (!is_array($item) OR count($item) === 0){ 

            return FALSE; 

        }else{ 

            if (!isset($item['rowid'], $this->cart_contents[$item['rowid']])){ 

                return FALSE; 

            }else{ 

                // prep the quantity 

                if(isset($item['qty'])){ 

                    $item['qty'] = (float) $item['qty']; 

                    // remove the item from the cart, if quantity is zero 

                    if ($item['qty'] == 0){ 

                        unset($this->cart_contents[$item['rowid']]); 

                        return TRUE; 

                    } 

                } 

                 

                // find updatable keys 

                $keys = array_intersect(array_keys($this->cart_contents[$item['rowid']]), array_keys($item)); 

                // prep the price 

                if(isset($item['price'])){ 

                    $item['price'] = (float) $item['price']; 

                } 

                // product id & name shouldn't be changed 

                foreach(array_diff($keys, array('id', 'name')) as $key){ 

                    $this->cart_contents[$item['rowid']][$key] = $item[$key]; 

                } 

                // save cart data 

                $this->save_cart(); 

                return TRUE; 

            } 

        } 

    } 

     

    /** 

     * Save the cart array to the session 

     * @return    bool 

     */ 

    protected function save_cart(){ 

        $this->cart_contents['total_items'] = $this->cart_contents['cart_total'] = 0; 

        foreach ($this->cart_contents as $key => $val){ 

            // make sure the array contains the proper indexes 

            if(!is_array($val) OR !isset($val['price'], $val['qty'])){ 

                continue; 

            } 

      

            $this->cart_contents['cart_total'] += ($val['price'] * $val['qty']); 

            $this->cart_contents['total_items'] += $val['qty']; 

            $this->cart_contents[$key]['subtotal'] = ($this->cart_contents[$key]['price'] * $this->cart_contents[$key]['qty']); 

        } 

         

        // if cart empty, delete it from the session 

        if(count($this->cart_contents) <= 2){ 

            unset($_SESSION['cart_contents']); 

            return FALSE; 

        }else{ 

            $_SESSION['cart_contents'] = $this->cart_contents; 

            return TRUE; 

        } 

    } 

     

    /** 

     * Remove Item: Removes an item from the cart 

     * @param    int 

     * @return    bool 

     */ 

     public function remove($row_id){ 

        // unset & save 

        unset($this->cart_contents[$row_id]); 

        $this->save_cart(); 

        return TRUE; 

     } 

      

    /** 

     * Destroy the cart: Empties the cart and destroy the session 

     * @return    void 

     */ 

    public function destroy(){ 

        $this->cart_contents = array('cart_total' => 0, 'total_items' => 0); 

        unset($_SESSION['cart_contents']); 

    } 

}



////////////////////////////////     cartAction.php  /////////////////////////////////////////


<?php 

// Initialize shopping cart class 

require_once 'Cart.class.php'; 

$cart = new Cart; 

 

// Include the database config file 

require_once 'dbConfig.php'; 

 

// Default redirect page 

$redirectLoc = 'index.php'; 

 

// Process request based on the specified action 

if(isset($_REQUEST['action']) && !empty($_REQUEST['action'])){ 

    if($_REQUEST['action'] == 'addToCart' && !empty($_REQUEST['id'])){ 

        $productID = $_REQUEST['id']; 

         

        // Get product details 

        $query = $db->query("SELECT * FROM products WHERE id = ".$productID); 

        $row = $query->fetch_assoc(); 

        $itemData = array( 

            'id' => $row['id'], 

            'name' => $row['name'], 

            'price' => $row['price'], 

            'qty' => 1 

        ); 

         

        // Insert item to cart 

        $insertItem = $cart->insert($itemData); 

         

        // Redirect to cart page 

        $redirectLoc = $insertItem?'viewCart.php':'index.php'; 

    }elseif($_REQUEST['action'] == 'updateCartItem' && !empty($_REQUEST['id'])){ 

        // Update item data in cart 

        $itemData = array( 

            'rowid' => $_REQUEST['id'], 

            'qty' => $_REQUEST['qty'] 

        ); 

       echo $updateItem = $cart->update($itemData); 

         

        // Return status 

        echo $updateItem?'ok':'err';die; 

    }elseif($_REQUEST['action'] == 'removeCartItem' && !empty($_REQUEST['id'])){ 

        // Remove item from cart 

        $deleteItem = $cart->remove($_REQUEST['id']); 

         

        // Redirect to cart page 

        $redirectLoc = 'viewCart.php'; 

    }elseif($_REQUEST['action'] == 'placeOrder' && $cart->total_items() > 0){ 

        $redirectLoc = 'checkout.php'; 

         

        // Store post data 

        $_SESSION['postData'] = $_POST; 

     

        $first_name = strip_tags($_POST['first_name']); 

        $last_name = strip_tags($_POST['last_name']); 

        $email = strip_tags($_POST['email']); 

        $phone = strip_tags($_POST['phone']); 

        $address = strip_tags($_POST['address']); 

         

        $errorMsg = ''; 

        if(empty($first_name)){ 

            $errorMsg .= 'Please enter your first name.<br/>'; 

        } 

        if(empty($last_name)){ 

            $errorMsg .= 'Please enter your last name.<br/>'; 

        } 

        if(empty($email)){ 

            $errorMsg .= 'Please enter your email address.<br/>'; 

        } 

        if(empty($phone)){ 

            $errorMsg .= 'Please enter your phone number.<br/>'; 

        } 

        if(empty($address)){ 

            $errorMsg .= 'Please enter your address.<br/>'; 

        } 

         

        if(empty($errorMsg)){ 

            // Insert customer data in the database 

            $insertCust = $db->query("INSERT INTO customers (first_name, last_name, email, phone, address) VALUES ('".$first_name."', '".$last_name."', '".$email."', '".$phone."', '".$address."')"); 

             

            if($insertCust){ 

                $custID = $db->insert_id; 

                 

                // Insert order info in the database 

                $insertOrder = $db->query("INSERT INTO orders (customer_id, grand_total, created, status) VALUES ($custID, '".$cart->total()."', NOW(), 'Pending')"); 

             

                if($insertOrder){ 

                    $orderID = $db->insert_id; 

                     

                    // Retrieve cart items 

                    $cartItems = $cart->contents(); 

                     

                    // Prepare SQL to insert order items 

                    $sql = ''; 

                    foreach($cartItems as $item){ 

                        $sql .= "INSERT INTO order_items (order_id, product_id, quantity) VALUES ('".$orderID."', '".$item['id']."', '".$item['qty']."');"; 

                    } 

                     

                    // Insert order items in the database 

                    $insertOrderItems = $db->multi_query($sql); 

                     

                    if($insertOrderItems){ 

                        // Remove all items from cart 

                        $cart->destroy(); 

                         

                        // Redirect to the status page 

                        $redirectLoc = 'orderSuccess.php?id='.$orderID; 

                    }else{ 

                        $sessData['status']['type'] = 'error'; 

                        $sessData['status']['msg'] = 'Some problem occurred, please try again.'; 

                    } 

                }else{ 

                    $sessData['status']['type'] = 'error'; 

                    $sessData['status']['msg'] = 'Some problem occurred, please try again.'; 

                } 

            }else{ 

                $sessData['status']['type'] = 'error'; 

                $sessData['status']['msg'] = 'Some problem occurred, please try again.'; 

            } 

        }else{ 

            $sessData['status']['type'] = 'error'; 

            $sessData['status']['msg'] = 'Please fill all the mandatory fields.<br>'.$errorMsg;  

        } 

        $_SESSION['sessData'] = $sessData; 

    } 

 

// Redirect to the specific page 

header("Location: $redirectLoc"); 

exit();

?>



////////////////////////// place-order.php



 <?php 

 

require_once 'db_connect.php'; 

  @session_start();

  require_once 'Cart.class.php'; 

$cart = new Cart;

 $total_amount=$cart->total();

  date_default_timezone_set('Asia/Kolkata');

  $from_date = date( 'd-m-Y h:i A', time () ); 

 $from_date1=date('d-m-Y');

 $disssccont=number_format(@$_SESSION['discount_amount'],2);

$totasubbb=number_format(@$_SESSION['sub_newtotal'],2);

   $full_name=$_POST['name'];

                     $email=$_POST['email'];

                      $mobile=$_POST['mobile'];

                       $full_address=$_POST['full_address'];

                        $zip=$_POST['zip'];

                           $City=$_POST['City'];

                            $payment_type=$_POST['payment_type'];

                               $grand_amount=number_format($_POST['grand_amount'],2);

                           if(!empty($_SESSION['discount_amount']) && !empty($_SESSION['sub_newtotal'])){

                                $grand_amounttt=$_SESSION['sub_newtotal'];

                                  $discountt=$_SESSION['discount_amount'];

                        $coupon_code=$_SESSION['login_promo'];

  echo  $sqlww="INSERT INTO tbl_order(full_name,email,mobile,full_address,city,zip_code,payment_type,total_amount,order_status,from_date,order_time,discount,coupon_code)VALUES('$full_name','$email','$mobile','$full_address','$City','$zip','$payment_type','$grand_amounttt','1','$from_date1','$from_date','$discountt','$coupon_code')";       

                               

                           }else{

                        

                        

 echo    $sqlww="INSERT INTO tbl_order(full_name,email,mobile,full_address,city,zip_code,payment_type,total_amount,order_status,from_date,order_time)VALUES('$full_name','$email','$mobile','$full_address','$City','$zip','$payment_type','$total_amount','1','$from_date1','$from_date')";       

                         

 }

// die;

    $runn=mysqli_query($conn,$sqlww);

    $lastid=mysqli_insert_id($conn);

    $ord="70000800";

    $orderid=$ord.$lastid;

    $inv="BAEVELA900";

    $invoiceid=$inv.$lastid;

    $updateqq="UPDATE tbl_order SET order_id='$orderid',invoice_id='$invoiceid' WHERE id='$lastid'";

    $rubnn=mysqli_query($conn,$updateqq);

    

    

          $cartItems = $cart->contents(); 

                     

                    // Prepare SQL to insert order items 

                    $sql = ''; 

                    foreach($cartItems as $item){ 

                        $sql .= "INSERT INTO order_items (order_id, product_id, quantity,price) VALUES ('".$orderid."', '".$item['id']."', '".$item['qty']."','".$item['price']."');"; 

                    } 

                     

                    // Insert order items in the database 

                    $insertOrderItems = $db->multi_query($sql); 

                   

                   

                     

                    if($insertOrderItems){ 

                        // Remove all items from cart 

                        $cart->destroy(); 

                       /*  echo '<div class="alert alert-success alert-dismissible">

  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>

  <strong>Success!</strong> Your order has been successfully placed. <strong>Order Id-'.$orderid.' </strong>

</div>';*/

$_SESSION['orderrrr_id']=$orderid;

                        // Redirect to the status page 

                        //$redirectLoc = 'orderSuccess.php?id='.$orderID; 

                    }

                        

                    $ppp ="<th span style='background-color:darkred;color:white;text-align: center;' colspan='2'>Price Details</th>";

//$oid=$OrderId.$lastid;

$queryyyw="SELECT*FROM order_items WHERE order_id='$orderid'";

$rusj=mysqli_query($con,$queryyyw);

while($fetch_dataaa=mysqli_fetch_array($rusj)){

  $product_id=$fetch_dataaa['product_id']; 

  $queryyy="SELECT*FROM product_master WHERE id='$product_id'";

  $runnnn=mysqli_query($con,$queryyy);

  $fetch_data=mysqli_fetch_array($runnnn);

  $name=$fetch_data['productName'];

   $pricee=$fetch_dataaa['price'];

   $quantity=$fetch_dataaa['quantity'];

   $dashh="X";


$ppp .="

<tr>

<td>".$name."</td>

<td>&#8377;".number_format($pricee,2).$dashh.$quantity."</td>

</tr>";

}


if(!empty($_SESSION['discount_amount']) && !empty($_SESSION['sub_newtotal'])){

    $diss="

     <tr>

    <th>Total Amount</th>

    <th>&#8377;$grand_amount</th>

  </tr>

    <tr>

    <th>Discount Amount</th>

    <th>-&#8377;$disssccont</th>

  </tr>

    <tr>

    <th>Grand Amount</th>

    <th>&#8377;$totasubbb</th>

  </tr>";

    

}else{

   $diss="

  

    <tr>

    <th>Total Amount</th>

    <th>&#8377;$grand_amount</th>

  </tr>";   

}

 

                    

                    

                   $to      = $email;

        $subject = 'Baevella Product New Order!';

        $message="<html>

<head>

  <style>

table {

    font-family: arial, sans-serif;

    border-collapse: collapse;

    width: 96%;

   

}


td, th {

    border: 1px solid #dddddd;

    text-align: left;

    padding: 8px;

}


tr:nth-child(even) {

    background-color: #dddddd;

}

</style>

</head>

<body>

<img  src='https://www.baevella.com/logo.jpg' >

<p>Dear <b style='color:#ea670c;'>$full_name</p></b>

   <p>Thank You For Purchasing Baevella Product. Someone will call and visit shortly. Your patience is 

highly appreciated.

</P>

 

<table id='customers'>

  <tr>

    <th colspan='2'>Order Summary</th>

    

  </tr>

    <tr>

    <td>Order Id</td>

    <td>$orderid</td>

  

  </tr>

 <tr>

    <td>Invoice Id</td>

    <td>$invoiceid</td>

  

  </tr>

    

 

  <tr>

    <td>Name</td>

    <td>$full_name</td>

  

  </tr>

   <tr>

    <td>Email</td>

    <td>$email</td>

  

  </tr>

   <tr>

    <td>Mobile</td>

    <td>$mobile</td>

  

  </tr>

   

   <tr>

    <td>Address</td>

    <td>$full_address</td>

  

  </tr>

  <tr>

    <td>Zip Code</td>

    <td>$zip</td>

  

  </tr>


  $ppp


  <tr>

    <td>Payment Type</td>

    <td>Cash</td>

  

  </tr>

  <tr>

    <td>Order Date</td>

    <td>$from_date1</td>

  

  </tr>

 

  

$diss

 

  

</table>


</body>

</html>";

//echo $message;die;

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

//$headers .= "From: info@baevella.com\r\n";

   $headers .= 'From: BAEVELLA <info@baevella.com>' . "\r\n";

//$headers .= 'cc:ravindrayadav170@yahoo.com\r\n';

//$headers .= "Bcc: users170@gmail.com\r\n";

$headers .= 'Cc: users1328@gmail.com' . "\r\n";

$headers .= 'Bcc: users54030@gmail.com' . "\r\n";

mail($to, $subject, $message, $headers);

            //echo $email = $row['c_email'];       

    echo "<script type='text/javascript'> document.location = 'order-success.php'; </script>";                      

?>


  <!-- START SECTION BREADCRUMB -->

<div class="breadcrumb_section bg_gray page-title-mini">

    <div class="container"><!-- STRART CONTAINER -->

        <div class="row align-items-center">

         <div class="col-md-6">

                <div class="page-title">

             <h1>Place Order </h1>

                </div>

            </div>

        </div>

    </div><!-- END CONTAINER-->

</div>

<!-- END SECTION BREADCRUMB -->

<?php 


if(isset($_GET['cart_delete'])){

    $q = mysqli_query($con,"delete from cart_master where id='$_GET[cart_delete]'");

    if($q){

        echo "<script>location.href='cart.php';</script>";

    }

} ?>

<!-- START MAIN CONTENT -->

<div class="main_content">

<?php 

               //$userIP = $_SERVER['REMOTE_ADDR'];

              // $product_get = mysqli_query($con,"select * from cart_master where ip = '$userIP'");

?>


<!-- START SECTION SHOP -->

<div class="section">


</div>

<!-- END SECTION SHOP -->


<!-- START SECTION SUBSCRIBE NEWSLETTER -->

<div class="section bg_default small_pt small_pb">

<div class="container">

     <div class="row align-items-center">

            <div class="col-md-6">

                <div class="heading_s1 mb-md-0 heading_light">

                    <h3>Subscribe Our Newsletter</h3>

                </div>

            </div>

            <div class="col-md-6">

                <div class="newsletter_form">

                    <form>

                        <input type="text" required="" class="form-control rounded-0" placeholder="Enter Email Address">

                        <button type="submit" class="btn btn-dark rounded-0" name="submit" value="Submit">Subscribe</button>

                    </form>

                </div>

            </div>

        </div>

    </div>

</div>

<!-- START SECTION SUBSCRIBE NEWSLETTER -->


</div>

<!-- END MAIN CONTENT -->

<script>

function updateCartItem(id){

     var qty=$("#hhddhdh"+id).val();

    $.get("cartAction.php", {action:"updateCartItem", id:id, qty:qty}, function(data){

        window.location.reload();

        if(data == 'ok'){

            location.reload();

        }else{

          //  alert('Cart update failed, please try again.');

        }

    });

}

</script>

<script>

    function updateCart(id)

    {

        $.ajax({

            url:updqty.php,

            type:'POST',

            data:$("#frm"+id).serialize(),

            success:function(res){

                

            }

        });

    }

</script>


<?php 


 include ('include/footer.php');

?>






////////////////////////////// table  ////////////////////////////////////////




-- phpMyAdmin SQL Dump

-- version 5.1.0

-- https://www.phpmyadmin.net/

--

-- Host: 127.0.0.1

-- Generation Time: Jun 09, 2022 at 08:58 PM

-- Server version: 10.4.19-MariaDB

-- PHP Version: 7.3.28


SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

START TRANSACTION;

SET time_zone = "+00:00";



/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

/*!40101 SET NAMES utf8mb4 */;


--

-- Database: `hr_ecommerce`

--


-- --------------------------------------------------------


--

-- Table structure for table `tbl_order`

--


CREATE TABLE `tbl_order` (

  `id` int(11) NOT NULL,

  `order_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `invoice_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `full_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `mobile` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `full_address` text COLLATE utf8_unicode_ci NOT NULL,

  `city` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `zip_code` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `total_amount` int(11) NOT NULL,

  `discount` int(11) NOT NULL,

  `coupon_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,

  `payment_type` int(11) NOT NULL,

  `razorpay_payment_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,

  `from_date` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `order_time` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `order_status` int(11) NOT NULL,

  `order_complete_date` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `update_data` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


--

-- Dumping data for table `tbl_order`

--


INSERT INTO `tbl_order` (`id`, `order_id`, `invoice_id`, `full_name`, `email`, `mobile`, `full_address`, `city`, `zip_code`, `total_amount`, `discount`, `coupon_code`, `payment_type`, `razorpay_payment_id`, `from_date`, `order_time`, `order_status`, `order_complete_date`, `update_data`) VALUES

(1, '', '', 'Ravindra Yadav', 'ravindrayadav170@yahoo.com', '6299812434', 'New Delhi', 'Delhi', '110046', 7693, 0, NULL, 1, NULL, '08-06-2022', '08-06-2022 11:02 PM', 1, '', '2022-06-08 17:34:38'),

(2, '700008002', 'BAEVELA9002', 'Ravindra Yadav', 'ravindrayadav170@yahoo.com', '6299812434', 'New Delhi', 'Delhi', '110046', 7693, 0, NULL, 1, NULL, '08-06-2022', '08-06-2022 11:05 PM', 1, '', '2022-06-08 17:35:51');


--

-- Indexes for dumped tables

--


--

-- Indexes for table `tbl_order`

--

ALTER TABLE `tbl_order`

  ADD PRIMARY KEY (`id`);


--

-- AUTO_INCREMENT for dumped tables

--


--

-- AUTO_INCREMENT for table `tbl_order`

--

ALTER TABLE `tbl_order`

  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

COMMIT;


/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;




Comments

Popular posts from this blog

how manage leads mangement system user and manager auto assign in php how manage leads mangement system user and manager auto assign in php how manage leads mangement system user and manager auto assign in php

How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php How to add date filter in php

How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python