55ok
| Direktori : /home/u307599615/domains/costumeonrent.in/public_html/ |
| Current File : /home/u307599615/domains/costumeonrent.in/public_html/product.php |
<?php
include('include/header.php');
?>
<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;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
h5.pro_price {
font-size: 14px;
color: black;
font-weight: 600;
margin-top: 5px;
display: inline;
}
/* 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>
<div class="container">
<!-- Sidebar -->
<!-- <div class="sidebar">
<div class="filter-group">
<h4>AVAILABILITY</h4>
<div class="filter-options">
<label><input type="checkbox" /> In stock</label>
<label><input type="checkbox" /> Out of stock</label>
</div>
</div>
<div class="filter-group">
<h4>PRICE</h4>
<div class="filter-options">
<div class="price-range">
<span>Rs. 0</span>
<span>Rs. 2,439</span>
</div>
<input type="range" min="0" max="2439" class="slider" />
</div>
</div>
<div class="filter-group">
<h4>SIZE</h4>
<div class="filter-options">
<label><input type="checkbox" /> Small</label>
<label><input type="checkbox" /> Medium</label>
<label><input type="checkbox" /> Large</label>
</div>
</div>
</div> -->
<!-- Main Content -->
<div class="main-content">
<!-- <div class="toolbar">
<div>Showing 51 products</div>
<div>
<label for="sort">Sort By:</label>
<select id="sort">
<option>Date, new to old</option>
<option>Date, old to new</option>
<option>Price, low to high</option>
<option>Price, high to low</option>
</select>
</div>
</div> -->
<!-- Product Grid -->
<?php
$mid_slug = $_GET['slug'] ?? '';
if (!$mid_slug) exit('<p>No category selected.</p>');
$mid = mysqli_fetch_assoc(mysqli_query($con, "SELECT * FROM mid_category WHERE slug='$mid_slug' LIMIT 1"));
if (!$mid) exit('<p>Category not found.</p>');
$m_id = $mid['m_id'];
$t_id = $mid['t_id'];
$products = mysqli_query($con, "SELECT * FROM product WHERE activity='yes' AND m_id='$m_id' AND t_id='$t_id' ORDER BY p_id DESC");
?>
<div class="product-grid">
<?php if (mysqli_num_rows($products)): ?>
<?php while ($p = mysqli_fetch_assoc($products)):
$imgs = json_decode($p['Image'], true);
$img = $imgs[0] ?? 'default.jpg';
?>
<div class="product-card">
<a href="<?= path(); ?>product-details.php?slug=<?= $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">Rent: Rs. <?= htmlspecialchars($p['rent']); ?></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');
?>