55ok

Mini

Direktori : /home/u307599615/domains/costumeonrent.in/public_html/
Upload File :
Current File : /home/u307599615/domains/costumeonrent.in/public_html/costumes-details.php

<?php
include("admin/connection.php");
include('include/header.php');
?>

<style>
    .container {
        display: flex;
        flex-wrap: wrap;
        gap: 40px;
        align-items: flex-start;
        margin-top: 40px;
    }

    /* ---------- Image Gallery ---------- */
    .product-image {
        flex: 1 1 40%;
        max-width: 500px;
    }

    .main-image {
        width: 100%;
        border-radius: 10px;
        border: 1px solid #eee;
        margin-bottom: 15px;
        transition: all 0.3s ease-in-out;
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }

    .thumbnail-list {
        display: flex;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
        margin-bottom: 40px;
    }

    .thumbnail-list img {
        width: 80px;
        height: 80px;
        border-radius: 8px;
        border: 2px solid transparent;
        cursor: pointer;
        object-fit: cover;
        transition: 0.3s;
    }

    .thumbnail-list img:hover,
    .thumbnail-list img.active {
        border-color: #ff1472;
        transform: scale(1.05);
    }

    /* ---------- Product Details ---------- */
    .product-details {
        flex: 1 1 50%;
        margin-bottom: 30px;
    }

    .product-title {
        font-size: 26px;
        font-weight: 700;
        margin-bottom: 10px;
        line-height: 1.4;
    }

    .price {
        font-size: 20px;
        font-weight: bold;
        margin: 10px 0;
        display: contents;
    }

    .save {
        color: #0073e6;
        font-size: 15px;
        margin-bottom: 15px;
    }

    .note {
        background: #f2f7f7;
        padding: 8px 10px;
        font-size: 14px;
        color: #444;
        margin-bottom: 15px;
        border-radius: 5px;
    }

    .quantity-box {
        display: inline-flex;
        align-items: center;
        border: 1px solid #ccc;
        border-radius: 5px;
        margin-bottom: 15px;
    }

    .quantity-box button {
        border: none;
        background: #f1f1f1;
        padding: 10px 14px;
        font-size: 18px;
        cursor: pointer;
    }

    .quantity-box input {
        width: 50px;
        text-align: center;
        border: none;
        outline: none;
        font-size: 16px;
    }

    .pincode-box {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
    }

    .pincode-box input {
        border: 1px solid #ccc;
        border-radius: 5px;
        padding: 10px;
        font-size: 16px;
    }

    .pincode-box button {
        background: #005eff;
        color: #fff;
        border: none;
        padding: 10px 16px;
        border-radius: 5px;
        cursor: pointer;
    }

    .delivery {
        color: green;
        font-size: 15px;
        margin-bottom: 20px;
    }

    .add-to-cart {
        background: #ff1472;
        color: white;
        padding: 10px;
        font-size: 18px;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        transition: 0.3s;
        width: 100%;
    }

    .add-to-cart:hover {
        background: #e01264;
    }

    .social {
        margin-top: 25px;
    }

    .social a {
        text-decoration: none;
        margin-right: 10px;
        display: inline-block;
    }

    .social i {
        font-size: 24px;
        border-radius: 50%;
        padding: 10px;
        color: #fff;
    }

    .insta {
        background: #e1306c;
    }

    .whatsapp {
        background: #25d366;
    }

    @media (max-width: 768px) {
        .container {
            flex-direction: column;
            margin-top: 20px;
        }

        .product-image,
        .product-details {
            flex: 1 1 100%;
            width: 100%;
            margin-bottom: 30px;
        }
    }
</style>

<?php


// Fetch product using slug from URL
if (isset($_GET['slug'])) {
    $slug = mysqli_real_escape_string($con, $_GET['slug']);
    $query = mysqli_query($con, "SELECT * FROM `costumes` WHERE slug='$slug' LIMIT 1");

    if (mysqli_num_rows($query) > 0) {
        $row = mysqli_fetch_assoc($query);
        $pro_name = $row['pro_name'];
        $rent = $row['rent'];
        $buy = $row['buy'];
        $Image = $row['Image'];
        $c_id = $row['c_id'];
        $images = json_decode($Image, true);
?>

        <div class="container product__items">
            <!-- Product Image Gallery -->
            <div class="product-image">
                <?php if (!empty($images)) { ?>
                    <img id="mainImage" src="admin/assets/images/categorie/<?php echo htmlspecialchars($images[0]); ?>"
                        alt="<?php echo htmlspecialchars($pro_name); ?>" class="main-image">

                    <div class="thumbnail-list">
                        <?php
                        foreach ($images as $index => $img) {
                            $activeClass = ($index === 0) ? 'active' : '';
                            echo '<img src="admin/assets/images/categorie/' . htmlspecialchars($img) . '" 
                                   class="thumbnail ' . $activeClass . '" 
                                   alt="Thumbnail">';
                        }
                        ?>
                    </div>
                <?php } else {
                    echo "<p>No Image Available</p>";
                } ?>
            </div>

            <!-- Product Details -->
            <div class="product-details">
                <h1 class="product-title"><?php echo htmlspecialchars($pro_name); ?></h1>

                <div class="price">Rent: ₹<?php echo htmlspecialchars($rent); ?></div>
                <div class="price">Buy: ₹<?php echo htmlspecialchars($buy); ?></div>
                <div class="note">No dispatch on Sunday</div>

                <div class="pincode-box">
                    <input type="text" id="pincode" placeholder="Enter Pincode">
                    <button type="button">Check</button>
                </div>

                <div class="delivery">Delivery will be in next 1 to 2 working days</div>

                <!-- Add to Cart Form -->
                <form method="POST">
                    <input type="hidden" name="product_id" value="<?= $c_id; ?>">
                    <input type="hidden" name="pro_name" value="<?= htmlspecialchars($pro_name); ?>">
                    <input type="hidden" name="buy" value="<?= htmlspecialchars($buy); ?>">
                    <input type="hidden" name="cimage" value="<?= htmlspecialchars($images[0] ?? 'default.jpg'); ?>">

                    <button type="button" class="add-to-cart" onclick="addToCart(this);">ADD TO CART</button>
                </form>

                <div class="social">
                    <a href="#" class="insta"><i class="fab fa-instagram"></i></a>
                    <a href="#" class="whatsapp"><i class="fab fa-whatsapp"></i></a>
                </div>
            </div>
        </div>
<?php
    } else {
        echo "<p style='color:red;text-align:center;'>Product not found!</p>";
    }
} else {
    echo "<p style='color:red;text-align:center;'>Invalid request! Slug missing.</p>";
}
?>


<!-- Font Awesome -->
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> <!-- Gallery & Quantity Script -->
<script>
    // Image gallery click functionality
    document.addEventListener('DOMContentLoaded', () => {
        const thumbnails = document.querySelectorAll('.thumbnail');
        const mainImage = document.getElementById('mainImage');

        thumbnails.forEach(thumb => {
            thumb.addEventListener('click', function() {
                thumbnails.forEach(t => t.classList.remove('active'));
                this.classList.add('active');
                mainImage.src = this.src;
            });
        });
    });
</script>

<?php include('include/footer.php'); ?>

Zerion Mini 1.0