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/public_html/ |
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<title><?php echo $company_name; ?> - Wishlist</title>
<div class="col-md-12 col-xs-12" id="product_msg"></div>
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Your Wishlist</h2>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Wishlist</li>
</ul>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<!-- Start Shop Page -->
<div class="shop-box-inner">
<div class="container">
<div class="row">
<div class="col-xl-9 col-lg-9 col-sm-12 col-xs-12 shop-content-right">
<div class="right-product-box">
<div class="product-categorie-box">
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade show active" id="grid-view">
<div class="row">
<?php
$sql = "SELECT COUNT(id) FROM favs 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 = 40;
//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 favs 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>';
$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$previous&id=$cat_id\"> Prev </a>";
//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>';
$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$i&id=$cat_id\"> $i </a>";
}
}
}
//render target number bt not link
//$paginationCtrls .= ''.$pagenum.' ';
$paginationCtrls .= '<a href="#">'.$pagenum.'</a>';
//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>';
$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$i&id=$cat_id\"> $i </a>";
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>';
$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$next&id=$cat_id\"> Next </a>";
}
}
if(mysqli_num_rows($query) > 0){
while ($row_back_deals = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$product_id = $row_back_deals['product_id'];
$stmt_caa = $con -> prepare('SELECT * FROM products WHERE product_id = ?');
$stmt_caa -> bind_param('s',$product_id);
$stmt_caa -> execute();
$stmt_caa -> store_result();
$stmt_caa -> bind_result($product_id,$product_cat,$product_brand,$product_title,$product_price,$product_desc,$product_image,$product_keywords,$old_price,$new_tag,$home_products,$tags,$in_stock,$featured,$picture2,$picture3,$picture4,$picture5,$picture6);
$numrows_caa = $stmt_caa -> num_rows();
if($numrows_caa > 0){
while ($stmt_caa -> fetch()) {
//calculate the rating of each product
$stmt_reviews1 = $con -> prepare('SELECT rating FROM product_reviews WHERE product_id = ?');
$stmt_reviews1 -> bind_param('s',$product_id);
$stmt_reviews1 -> execute();
$stmt_reviews1 -> store_result();
$stmt_reviews1 -> bind_result($product_rating);
$numrows_reviews1 = $stmt_reviews1 -> num_rows();
if($numrows_reviews1 > 0){
$total_rating = array();
while ($stmt_reviews1 -> fetch()) {
array_push($total_rating,$product_rating);
}
$all_ratings = array_sum($total_rating);
$average_rating = $all_ratings / $numrows_reviews1;
$rounded_up = round($average_rating);
$rating_display = " $rounded_up / 5";
}
else{$rating_display = "";$rounded_up = 0;}
?>
<div class="col-sm-6 col-md-6 col-lg-4 col-xl-4">
<?php include("product.php"); ?>
</div>
<?php
}
}
}
}
else{echo"You have not added any product to your wishlist";}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-sm-12 col-xs-12 sidebar-shop-left">
<div class="product-categori">
</div>
</div>
</div>
</div>
</div>
<!-- End Shop Page -->
<?php include("ig_feed.php"); ?>
<?php include("footer.php"); ?>