BLACKSITE
:
216.73.217.4
:
104.37.75.190 / alpenpass.ca
:
Linux server3.pointsplan.com 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
:
/
home
/
apca
/
www
/
Upload File:
files >> /home/apca/www/tour_listing.php
<?php include('includes/head.php'); $mTitle="Guided Motorcycle Tours in Vancouver | AlpenPass Adventures"; $mDescription="Discover guided motorcycle tours across Vancouver BC with AlpenPass. Scenic routes, top bikes, and unforgettable adventure await."; include('includes/header.php');?> <section class="page-header listing_page" style="background-image: url('assets/images/tours-header-1920.jpg')"> <div class="container"> <div class="page-header_wrap"> <div class="page-heading"> <h1>Tours</h1> </div> <ul class="coustom-breadcrumb"> <li><a href="#">Home</a></li> <li>Tours</li> </ul> </div> </div> <div class="dark-overlay"></div> </section> <section class="listing-page"> <div class="container" style="width:90vw !important;"> <div class="row"> <div class="col-md-9 col-md-push-3"> <div class="result-sorting-wrapper"> <div class="sorting-count"> <?php // Count total "Tours" products (excluding inactive ones) $sql = "SELECT COUNT(*) FROM tblproducts WHERE productsCategory='Tours' AND (TRIM(LOWER(tblproducts.ProductsStatus)) <> 'inactive' OR tblproducts.ProductsStatus IS NULL)"; $query = $dbh->prepare($sql); $query->execute(); $totalProducts = $query->fetchColumn(); ?> <p><span><?php echo htmlentities($totalProducts); ?> Tours Available</span></p> </div> </div> <div class="category-menu text-center mb-3"> <strong>Jump to Category:</strong> <?php // Get all "Tours" categories with their counts $categoryQuery = $dbh->query(" SELECT ProductsCategory, COUNT(*) as category_count FROM tblproducts WHERE productsCategory='Tours' AND (TRIM(LOWER(ProductsStatus)) <> 'inactive' OR ProductsStatus IS NULL) GROUP BY ProductsCategory ORDER BY ProductsCategory ASC "); $categories = $categoryQuery->fetchAll(PDO::FETCH_ASSOC); foreach ($categories as $cat) { // Find the first product row number in this category $categoryPositionQuery = $dbh->prepare(" SELECT MIN(id) FROM tblproducts WHERE ProductsCategory = 'Tours' AND (TRIM(LOWER(ProductsStatus)) <> 'inactive' OR ProductsStatus IS NULL) "); $categoryPositionQuery->execute(); $categoryRowNumber = $categoryPositionQuery->fetchColumn(); // Ensure $productsPerPage is correctly set $productsPerPage = isset($productsPerPage) && is_numeric($productsPerPage) && $productsPerPage > 0 ? $productsPerPage : 10; $categoryPage = (!isset($categoryRowNumber) || !is_numeric($categoryRowNumber) || $categoryRowNumber < 1) ? 1 : ceil($categoryRowNumber / $productsPerPage); // Generate category link echo "<a href='{$categoryPage}&category=" . urlencode($cat['ProductsCategory']) . "' class='btn btn-outline-primary mx-1 my-1 category-link' data-category='" . htmlentities($cat['ProductsCategory']) . "' data-'{$categoryPage}'> " . htmlentities($cat['ProductsCategory']) . " (" . $cat['category_count'] . ") </a>"; } ?> </div> <?php // **Pagination Setup** $productsPerPage = 10; $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0 ? intval($_GET['page']) : 1; $offset = max(0, ($page - 1) * $productsPerPage); // **Fetch only "Tours" products grouped by category** $sql = "SELECT tblproducts.*, tblbrands.BrandName, tblbrands.id as bid FROM tblproducts JOIN tblbrands ON tblbrands.id = tblproducts.ProductsBrnd WHERE tblproducts.ProductsCategory='Tours' AND (TRIM(LOWER(tblproducts.ProductsStatus)) <> 'inactive' OR tblproducts.ProductsStatus IS NULL) ORDER BY tblproducts.ProductsTitle LIMIT :limit OFFSET :offset"; $query = $dbh->prepare($sql); $query->bindParam(':limit', $productsPerPage, PDO::PARAM_INT); $query->bindParam(':offset', $offset, PDO::PARAM_INT); $query->execute(); $products = $query->fetchAll(PDO::FETCH_OBJ); // **Keep track of category for headers** $currentCategory = null; if ($query->rowCount() > 0) { foreach ($products as $product) { // Display category header when the category changes if ($currentCategory !== $product->ProductsCategory) { $currentCategory = $product->ProductsCategory; // Fetch count of products in this category $categoryCountQuery = $dbh->prepare(" SELECT COUNT(*) FROM tblproducts WHERE ProductsCategory = 'Tours' AND (TRIM(LOWER(ProductsStatus)) <> 'inactive' OR ProductsStatus IS NULL) "); $categoryCountQuery->execute(); $categoryCount = $categoryCountQuery->fetchColumn(); echo "<h2 id='" . urlencode($currentCategory) . "' class='category-header text-center p-3 mt-4' style='background:#fb4d59; color:white; border-radius:5px; margin-bottom: 10px'> " . htmlentities($currentCategory) . " ({$categoryCount}) </h2>"; } ?> <div class="product-listing-m gray-bg"> <div class="product-listing-img"> <img src="admin/img/productimages/<?php echo htmlentities($product->Pimage1); ?>" class="img-responsive" alt="Image" /> </div> <div class="product-listing-content"> <h2><strong> <a href="product-details.php?phid=<?php echo htmlentities($product->id); ?>" style="color: #000;"> <?php echo htmlentities($product->ProductsTitle); ?> </a> </strong></h2> <p class="list-price"><?php echo htmlentities($product->ProductsModelNumber); ?></p> <p class="list-price"><?php echo htmlentities(substr(strip_tags($product->ProductsOverview), 0, 200)); ?>...</p> <?php if($product->ProductsSize){ ?> <p class="list-price"><strong>Size: <?php echo strip_tags($product->ProductsSize); ?></strong></p> <?php } if($product->ProductsColor){ ?> <p class="list-price"><strong>Colour: <?php echo strip_tags($product->ProductsColor); ?></strong></p> <?php } ?> <div style="font-size: 48px; font-weight: bold;"> <strong><?php echo htmlentities($product->ProductsRetail); ?></strong> </div> <a href="product-details.php?phid=<?php echo htmlentities($product->id); ?>" class="btn btn-primary"> View Details <span class="angle_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></span> </a> </div> </div> <?php } // End foreach loop } else { echo "<p>No tours available.</p>"; } ?> <!-- Pagination Controls --> <div class="pagination text-center mt-4"> <?php // **Calculate total pages** $totalPages = ceil($totalProducts / $productsPerPage); if ($page > 1) { echo '<a href="?page=' . ($page - 1) . '" class="btn btn-primary">« Prev</a>'; } for ($i = 1; $i <= $totalPages; $i++) { echo '<a href="?page=' . $i . '" class="btn ' . ($i == $page ? 'btn-dark' : 'btn-outline-primary') . '">' . $i . '</a>'; } if ($page < $totalPages) { echo '<a href="?page=' . ($page + 1) . '" class="btn btn-primary">Next »</a>'; } ?> </div> </div> <?php /** <div class="col-md-9 col-md-push-3"> <div class="result-sorting-wrapper"> <div class="sorting-count"> <?php $sql = "SELECT id from tblproducts"; $query = $dbh -> prepare($sql); $query->execute(); $results=$query->fetchAll(PDO::FETCH_OBJ); $cnt=$query->rowCount(); ?> <p><span><?php echo htmlentities($cnt);?> Product Listings</span></p> </div> </div> <?php $sql = "SELECT tblproducts.*, tblbrands.BrandName, tblbrands.id as bid FROM tblproducts JOIN tblbrands ON tblbrands.id = tblproducts.ProductsBrnd WHERE TRIM(LOWER(tblproducts.ProductsStatus)) <> 'inactive' OR tblproducts.ProductsStatus IS NULL; "; $query = $dbh -> prepare($sql); $query->execute(); $results=$query->fetchAll(PDO::FETCH_OBJ); $cnt=1; if($query->rowCount() > 0) { foreach($results as $result) { ?> <div class="product-listing-m gray-bg"> <div class="product-listing-img"><img src="admin/img/productimages/<?php echo htmlentities($result->Pimage1);?>" class="img-responsive" alt="Image" /> </a> </div> <div class="product-listing-content"> <h2><strong><a href="vehical-details.php?phid=<?php echo htmlentities($result->id);?>" style="color: #000;"><?php echo htmlentities($result->ProductsTitle);?></a></strong></h2> <p class="list-price">Model<?php echo htmlentities($result->ProductsModelNumber);?> </p> <p class="list-price"><?php echo truncateText(strip_tags($result->ProductsOverview), 40);?> </p> <p class="list-price"><strong>Size: <?php echo strip_tags($result->ProductsSize);?></strong> </p> <p class="list-price"><strong>Colour: <?php echo strip_tags($result->ProductsColor);?></strong> </p> <div style="font-size: 48px; font-weight: bold;"><strong><?php echo htmlentities($result->ProductsRetail);?></strong></div> <a href="product-details.php?phid=<?php echo htmlentities($result->id);?>" class="btn">View Details <span class="angle_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></span></a> </div> </div> <?php }} ?> </div> */ ?> <!--Side-Bar--> <aside class="col-md-3 col-md-pull-9"> <div class="sidebar_widget"> <div class="widget_heading"> <h5><i class="fa fa-search" aria-hidden="true"></i> Find Your Product </h5> </div> <div class="sidebar_filter"> <form action="search-productresult.php" method="post"> <input type="text" name="searchTerm" class="form-control"/><br /><br /> <div class="form-group"> <button type="submit" class="btn btn-block"><i class="fa fa-search" aria-hidden="true"></i> Search Products</button> </div> </form> </div> </div> <div class="sidebar_widget"> <div class="widget_heading"> <h5><i class="fa fa-motorcycle" aria-hidden="true"></i> Recently Listed Products</h5> </div> <div class="recent_addedcars"> <ul> <?php $sql = "SELECT tblproducts.*,tblbrands.BrandName,tblbrands.id as bid from tblproducts join tblbrands on tblbrands.id=tblproducts.ProductsBrnd order by id desc limit 4"; $query = $dbh -> prepare($sql); $query->execute(); $results=$query->fetchAll(PDO::FETCH_OBJ); $cnt=1; if($query->rowCount() > 0) { foreach($results as $result) { ?> <li class="gray-bg"> <div class="recent_post_img"> <a href="product-details.php?phid=<?php echo htmlentities($result->id);?>"><img src="admin/img/productimages/<?php echo htmlentities($result->Pimage1);?>" alt="image"></a> </div> <div class="recent_post_title"> <a href="product-details.php?phid=<?php echo htmlentities($result->id);?>"><?php echo htmlentities($result->ProductsTitle);?></a> <a href="product-details.php?phid=<?php echo htmlentities($result->id);?>" class="btn">View Details <span class="angle_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></span></a> </div> </li> <?php }} ?> </ul> </div> </div> </aside> <!--/Side-Bar--> </div> </div> </section> <!-- /Listing--> <!--Footer --> <?php include('includes/footer.php');?> <!-- /Footer--> <!--Back to top--> <div id="back-top" class="back-top"> <a href="#top"><i class="fa fa-angle-up" aria-hidden="true"></i> </a> </div> <!--/Back to top--> <!--Login-Form --> <?php include('includes/login.php');?> <!--/Login-Form --> <!--Register-Form --> <?php include('includes/registration.php');?> <!--/Register-Form --> <!--Forgot-password-Form --> <?php include('includes/forgotpassword.php');?> <!-- Smooth Scrolling to Category --> <!-- Smooth Scrolling to Category --> <script> document.addEventListener("DOMContentLoaded", function() { const params = new URLSearchParams(window.location.search); const category = params.get("category"); if (category) { setTimeout(() => { let target = document.getElementById(category); if (target) { window.scrollTo({ top: target.offsetTop - 50, behavior: "smooth" }); } }, 500); } }); </script>