Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/domains/bond-lounge.com/public_html/ |
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("iframe_header.php"); ?>
<div class="dashboard-right-box">
<div class="order">
<div class="sidebar-title">
<div class="loader-line"></div>
<h4>My Orders History</h4>
</div>
<div class="row gy-4">
<?php
$sql = "SELECT COUNT(id) FROM my_orders WHERE user_id='$user_id' ORDER BY id DESC";
$query = mysqli_query($con, $sql);
$row = mysqli_fetch_row($query);
//here we have the total row count
$rows = $row[0];
//number of results we want per page
$page_rows = 3;
//tells us the page number of our last page
$last = ceil($rows/$page_rows);
//this makes sure last cannot be less than 1
if($last < 1){$last = 1;}
//establish the page num variable
$pagenum = 1;
//Get pageum from $GET if it is present, else its 1
if(isset($_GET['pn'])){
$pagenum = preg_replace('#[^0-9]#', '', $_GET['pn']);
}
//below 1 or more than last page
if($pagenum < 1){
$pagenum = 1;
}else if ($pagenum > $last) {
$pagenum = $last;
}
//this sets the range of rows to query for the chosen pagenum
$limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;
//grabs one page worth of rows
$sql = "SELECT * FROM my_orders WHERE user_id='$user_id' ORDER BY id DESC $limit ";
$query = mysqli_query($con, $sql);
//this shows the user what page they on and total number
$textline1 = "Messages $rows";
$textline2 = "Page $pagenum of $last";
//establish the pagination controls
$paginationCtrls = "";
//if there is more than one page worth of results
if($last != 1){
if($pagenum > 1){
$previous = $pagenum - 1;
//$paginationCtrls .='<a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'">Previous</a>  ';
$paginationCtrls .='<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'">Prev</a></li>';
//render clickable links to the left of target page number
for($i = $pagenum-4; $i < $pagenum; $i++){
if($i > 0){
//$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'"></a> ';
$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a></li>';
}
}
}
//render target number bt not link
//$paginationCtrls .= ''.$pagenum.' ';
$paginationCtrls .= '<li><a class="active" href="#">'.$pagenum.'</a></li>';
//render clickable number links to the right of target number
for($i = $pagenum+1; $i <= $last; $i++){
//$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a> ';
$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a></li>';
if($i >= $pagenum+4){
break;
}
}
//this does the same as above, only checking if we are on the last page
if($pagenum != $last) {
$next = $pagenum + 1;
$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$next.'">Next</a></li>';
}
}
if(mysqli_num_rows($query) > 0 ){$countt=0;
while ($row_ads = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$order_id = $row_ads['order_id'];
$order_status = $row_ads['status'];
$order_date_raw = $row_ads['nice_date'];
$order_total = $row_ads['total'];
$horrible_date = $row_ads['horrible_date'];
$location_api = $horrible_date;
$order_date_formatted1=date_create("$order_date_raw");
$order_date = date_format($order_date_formatted1,"D,dS M, Y");
$order_gt = $order_total;
?>
<div class="col-12">
<div class="order-box">
<div class="order-container">
<div class="order-icon"><i class="iconsax" data-icon="box"></i>
<div class="couplet" style='background:<?php if($order_status == "Completed"){echo"";}else{echo"red";} ?>;'><i class="fa-solid fa-<?php if($order_status == "Completed"){echo"check";}else{echo"xmark";} ?>"></i></div>
</div>
<div class="order-detail">
<h5 style='color:<?php if($order_status == "Completed"){echo"";}else{echo"red";} ?>;'><?php echo $order_status ?></h5>
<p><?php echo $order_date ?></p>
</div>
</div>
<div class="product-order-detai">
<div class="product-bo">
<div class="order-wrap">
</div>
<h5>ORDER ID:<?php echo "$order_id"; ?></h5>
<div class='container'>
<div class='row'>
<?php
$stmt1 = $con -> prepare('SELECT * FROM cart_details WHERE order_id=?');
$stmt1 -> bind_param('s',$order_id);
$stmt1 -> execute();
$stmt1 -> store_result();
$stmt1 -> bind_result($id,$order_id,$product_id,$product_title,$product_price,$product_image,$qty);
$numrows1 = $stmt1 -> num_rows();
if($numrows1 > 0){
while ($stmt1 -> fetch()) {
//get tags
$stmt2 = $con -> prepare('SELECT tags FROM products WHERE product_id=?');
$stmt2 -> bind_param('s',$product_id);
$stmt2 -> execute();
$stmt2 -> store_result();
$stmt2 -> bind_result($tags);
$numrows2 = $stmt2 -> num_rows();
if($numrows2 > 0){
while ($stmt2 -> fetch()) {}
}
echo"
<div class='col-6 col-md-2'>
<a href='product_details?product=$product_id'>
<img src='site_img/products/$product_image' alt='' style='width:100px;height:100px;border-radius:5px;'><br/>
<b>$product_title"; if($tags !==""){echo" ($tags $inches)";} echo"</b></a><br/>";echo $currency; echo number_format((float)$product_price, 2, '.', ',');
echo
"
<br/>Qty:$qty<hr/>";
echo"</div>";
$total = $qty * $product_price;
$total_array[] = $total;
}}
?>
</div>
</div>
<h5><?php echo $currency; echo number_format((float)$order_gt, 2, '.', ','); ?></h5>
<?php if($order_status == "Pending"){
} ?>
</div>
</div>
</div>
</div>
<?php
}//end of while
}
else{echo"No orders are available at this time.";}
?>
<div class="pagination-wrap mt-0">
<ul class="pagination">
<?php echo $paginationCtrls; ?>
</ul>
<?php echo "$textline2"; ?>
</div>
</div>
</div>
</div>
<?php include("iframe_footer.php"); ?>