<?php
session_start();
include("../../database.php");
$user_id=NULL;
if(isset($_SESSION['customer_email']))
{
$user_email=$_SESSION['customer_email'];
$query="SELECT * from users where email='$user_email'";
$user=db::getRecord($query);
$user_id=$user_email;
}else{
$user_id=session_id();
}
?>
<?php
$total_bill="0";
if(isset($_SESSION['customer_email']))
{
$user_email=$_SESSION['customer_email'];
$query="SELECT * from users where email='$user_email'";
$user=db::getRecord($query);
$user_id=$user_email;
}else{
$user_id=session_id();
}
$query="SELECT * FROM temp_cart where user_id='$user_id'";
$cart_items=db::getRecords($query);
if($cart_items != NULL){
foreach($cart_items as $cart_item)
{
$product_bill="0";
$id = $cart_item['id'];
$product_id = $cart_item['product_id'];
$product_data_id = $cart_item['product_data_id'];
$query="SELECT * from product where id='$product_id'";
$product=db::getRecord($query);
$query = "SELECT * from product_image where product_id = '$product_id' ";
$product_image = db::getRecord($query);
$cart_product_quantity = $cart_item['quantity'];
$total_bill= $total_bill + ($product_price * $cart_product_quantity ) ;
?>
<li class="product-cart mini_cart_item">
<a href="product-view.php?id=<?php echo $product['id'];?>" class="product-media">
<img src="<?php echo "admin/files/product/images/".$product_image['image_name']; ?>" alt="img">
</a>
<div class="product-details">
<h5 class="product-name">
<a href="product-view.php?id=<?php echo $product['id'];?>"><?php echo $product['name']; ?></a>
</h5>
<span class="product-price">
<span class="price">
<span>$<?php echo $product_data['price'];?></span>
</span>
</span>
<span class="product-quantity">
(x<?php echo $cart_item['quantity']; ?>)
</span>
<div class="product-remove">
<a onclick="get_data()" href="admin/action.php?product_id=<?php echo $product['id'];?>"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
</div>
</div>
</li>
<!-- Product Remove End -->
<!-- Cart Product/Price End -->
<?php
}
}
?>
<div class="subtotal">
<span class="total-title">Subtotal: </span>
<span class="total-price">
<span class="Price-amount">
$<?php echo $total_bill; ?>
</span>
</span>
</div>