55ok
| Direktori : /home/u307599615/domains/costumeonrent.in/public_html/ |
| Current File : /home/u307599615/domains/costumeonrent.in/public_html/more-accessories.php |
<?php
include("admin/connection.php");
include('include/header.php');
$query = "SELECT * FROM `slider` ORDER BY id DESC";
$sql = mysqli_query($con, $query);
?>
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<?php
$i = 0; // counter banaya
while ($row = mysqli_fetch_assoc($sql)) {
$active = ($i == 0) ? 'active' : ''; // sirf first slide active
?>
<div class="carousel-item <?php echo $active; ?>">
<img class="d-block w-100" src="<?php echo path(); ?>/admin/assets/images/slider/<?php echo $row['Image']; ?>" alt="Slide <?php echo $i + 1; ?>">
</div>
<?php
$i++;
}
?>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa;
}
.container {
display: flex;
padding: 20px;
}
a h5.pro_name {
font-size: 14px;
color: black;
font-weight: 600;
margin-top: 5px;
}
h5.pro_price {
font-size: 14px;
color: black;
font-weight: 600;
margin-top: 5px;
}
/* Sidebar */
.sidebar {
width: 250px;
margin-right: 20px;
background-color: #e0e9f2;
padding: 15px;
border-radius: 5px;
}
.filter-group {
margin-bottom: 30px;
background: white;
border: 1px solid #b3cbe1;
border-radius: 4px;
overflow: hidden;
}
.filter-group h4 {
background-color: #6b9bc7;
color: white;
padding: 10px;
margin: 0;
font-size: 16px;
}
.filter-options {
padding: 10px;
}
.filter-options label {
display: flex;
align-items: center;
margin-bottom: 10px;
font-weight: bold;
color: #444;
}
.filter-options input[type="checkbox"] {
margin-right: 10px;
}
.price-range {
display: flex;
justify-content: space-between;
font-size: 14px;
margin-bottom: 10px;
}
.slider {
width: 100%;
}
/* Main Content */
.main-content {
flex: 1;
}
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
background-color: #6b9bc7;
color: white;
padding: 10px 15px;
border-radius: 5px;
}
.toolbar select {
padding: 5px;
border-radius: 3px;
border: none;
outline: none;
}
.product-grid {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.product-card {
width: calc(25% - 20px);
background: white;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
text-align: center;
transition: transform 0.3s ease;
}
.product-card:hover {
transform: translateY(-5px);
}
.product-card img {
max-width: 100%;
height: auto;
border-radius: 4px;
aspect-ratio: 4 / 4;
}
@media (max-width: 992px) {
.product-card {
width: calc(33.33% - 20px);
}
}
@media (max-width: 768px) {
.container {
flex-direction: column;
}
.sidebar {
width: 100%;
margin-bottom: 20px;
}
.product-card {
width: calc(50% - 20px);
}
}
@media (max-width: 480px) {
.product-card {
width: 100%;
}
}
</style>
<?php
// Fetch mid category ID for "others"
$midQuery = mysqli_query($con, "SELECT m_id FROM mid_category WHERE LOWER(title) = 'accessories' LIMIT 1");
$midData = mysqli_fetch_assoc($midQuery);
if ($midData) {
$mid_id = $midData['m_id'];
// Fetch all products from "others" category
$productQuery = mysqli_query($con, "SELECT * FROM product WHERE m_id = '$mid_id' ORDER BY p_id DESC");
} else {
$productQuery = false;
}
?>
<!-- product section -->
<div class="container">
<!-- Main Content -->
<div class="main-content">
<!-- Product Grid -->
<div class="product-grid">
<?php if ($productQuery && mysqli_num_rows($productQuery) > 0): ?>
<?php while ($p = mysqli_fetch_assoc($productQuery)):
$imgs = json_decode($p['Image'], true);
$img = $imgs[0] ?? 'default.jpg';
?>
<div class="product-card">
<a href="<?= path(); ?>product-details.php?slug=<?= htmlspecialchars($p['slug']); ?>">
<img src="<?= path(); ?>/admin/assets/images/categorie/<?= $img; ?>" alt="<?= htmlspecialchars($p['pro_name']); ?>">
<h5 class="pro_name"><?= htmlspecialchars($p['pro_name']); ?></h5>
<h5 class="pro_price">Buy: Rs. <?= htmlspecialchars($p['buy']); ?></h5>
</a>
</div>
<?php endwhile; ?>
<?php else: ?>
<p>No products found in this category.</p>
<?php endif; ?>
</div>
</div>
</div>
<?php
include('include/footer.php');
?>