|
Server IP : 217.21.85.138 / Your IP : 216.73.216.103 Web Server : LiteSpeed System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u915722082 ( 915722082) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u915722082/.nvm/../public_html/lohri/user/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<!--index.php-->
<?php
session_start();
require_once __DIR__ . '/../config/config.php';
try {
$pdo = new PDO(
"mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8mb4",
DB_USER,
DB_PASS,
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]
);
} catch (PDOException $e) {
die("❌ Database connection failed: " . htmlspecialchars($e->getMessage()));
}
// ========== HELPERS ==========
function makeUrl($string) {
return strtolower(str_replace(' ', '-', preg_replace('/[^A-Za-z0-9 ]/', '', $string)));
}
function cleanDescription($rawHtml) {
if (empty($rawHtml)) return '';
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $rawHtml);
libxml_clear_errors();
$finder = new DomXPath($dom);
$qlEditor = $finder->query("//*[contains(@class, 'ql-editor')]")->item(0);
if ($qlEditor) {
$innerHTML = '';
foreach ($qlEditor->childNodes as $child) {
$innerHTML .= $dom->saveHTML($child);
}
return $innerHTML;
}
return $rawHtml;
}
function firstFromPimg(?string $pimg): string {
if (empty($pimg)) return '';
$decoded = json_decode($pimg, true);
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded) && !empty($decoded[0])) {
return trim($decoded[0]);
}
$parts = array_values(array_filter(array_map('trim', explode(',', $pimg))));
return !empty($parts) ? $parts[0] : '';
}
function getFirstGalleryImage(PDO $pdo, int $pid, ?string $pimg): ?string {
$p = firstFromPimg($pimg);
if ($p !== '') return $p;
$st = $pdo->prepare("SELECT image_path, variant_data FROM product_variations WHERE PID = ? ORDER BY price ASC");
$st->execute([$pid]);
while ($v = $st->fetch()) {
if (!empty($v['image_path'])) return trim($v['image_path']);
if (!empty($v['variant_data'])) {
$vd = json_decode($v['variant_data'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($vd)) {
if (!empty($vd['image'])) return trim($vd['image']);
if (!empty($vd['gallery']) && is_array($vd['gallery'])) {
foreach ($vd['gallery'] as $g) if (!empty($g)) return trim($g);
}
}
}
}
return null;
}
function fetchBanners(PDO $pdo, $gender = 'all'): array {
if ($gender === 'all') {
$sql = "SELECT id, img, titke, des FROM banner WHERE img IS NOT NULL AND img <> '' ORDER BY id DESC";
$stmt = $pdo->prepare($sql);
$stmt->execute();
} else {
$sql = "SELECT id, img, titke, des FROM banner WHERE img IS NOT NULL AND img <> '' AND cid = ? ORDER BY id DESC";
$stmt = $pdo->prepare($sql);
$stmt->execute([$gender]);
}
return $stmt->fetchAll();
}
// Replace the existing fetchCategories function with this:
function fetchCategories(PDO $pdo): array {
$sql = "SELECT category, pthumb, pdes FROM products WHERE status IN ('approved','published') GROUP BY category ORDER BY category ASC LIMIT 5";
try {
$stmt = $pdo->prepare($sql);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
error_log("fetchCategories error: " . $e->getMessage());
return [];
}
}
// Replace the call:
$categories1 = fetchCategories($pdo, $gender);
function fetchRandomProducts(PDO $pdo, int $limit = 2): array {
$sql = "SELECT p.pid AS PID, p.pname AS PNAME, p.pthumb AS PTHUMB, p.pdes AS PDES, p.category AS CATEGORY,
(SELECT pv.variant_title FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS VNAME,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS PRICE,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price DESC LIMIT 1) AS OLD_PRICE
FROM products p WHERE p.status IN ('approved','published') ORDER BY RAND() LIMIT :lim";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':lim', $limit, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetchAll();
}
$bannerUrlBase = '../Images/Setting';
$imageUrl = '../Images/Product';
$banners = fetchBanners($pdo, 'all'); // Initial load shows all
$categories1 = fetchCategories($pdo);
$lookProducts = fetchRandomProducts($pdo, 2);
?>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>TDS Multi-Vendor Marketplace — Login</title>
<?php include "../user/header.php" ?>
<style>
.gender-toggle-btn.inactive-btn {
pointer-events: none;
cursor: default;
color:black;
font-size: 30px;
}
@media (max-width: 400px) {
.heroImageSection {
height: 300px;
}
}
/* index */
/* 1.banner */
.main-container {
position: relative;
display: flex;
overflow-x: hidden;
padding-top: 30px;
}
.text-swiper-container {
width: 50%;
height: 55vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
flex-direction: column;
}
.swiper-wrapper {
flex: 1;
}
.swiper-slide-1 {
display: flex;
align-items: center;
justify-content: center;
background: white;
padding: 0 0px;
}
.slide-content {
width: 100%;
max-width: 700px;
text-align: center;
}
.slide-tag {
font-size: 14px;
color: #666666;
margin-bottom: 20px;
text-transform: capitalize;
letter-spacing: 1px;
font-weight: 500;
}
.slide-title {
font-size: 35px;
font-weight: 500;
line-height: 1.2;
margin-bottom: 40px;
color: black;
}
.slide-btn {
background: #000;
color: white;
padding: 10px 30px;
border: none;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
text-transform: capitalize;
letter-spacing: 0.5px;
}
.slide-btn:hover {
background: #333;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.static-image-container {
width: 50%;
height: 60vh;
right: 0;
top: 0;
overflow: hidden;
}
.image-swiper-container {
width: 100%;
height: 100%;
}
.image-slide {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.image-slide img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
margin: 0;
padding: 0;
border: none;
outline: none;
border-radius: 10px;
}
.swiper-navigation {
display: flex;
align-items: center;
justify-content: center;
gap: 40px;
padding-bottom: 40px;
background: white;
}
.swiper-button-prev,
.swiper-button-next {
position: static;
width: 50px;
height: 50px;
background: transparent;
border: 2px solid #ddd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
margin: 0;
}
.swiper-button-prev:hover,
.swiper-button-next:hover {
border-color: #333;
background: #333;
}
.swiper-button-prev::after,
.swiper-button-next::after {
font-size: 16px;
font-weight: bold;
color: #666;
transition: color 0.3s ease;
}
.swiper-button-prev:hover::after,
.swiper-button-next:hover::after {
color: white;
}
.swiper-pagination {
position: static !important;
width: auto !important;
display: flex;
gap: 8px;
align-items: center;
}
.swiper-pagination-bullet {
width: 40px;
height: 2px;
border-radius: 1px;
background: #ddd;
opacity: 1;
transition: all 0.3s ease;
cursor: pointer;
}
.swiper-pagination-bullet-active {
background: #333;
width: 60px;
}
.swiper-pagination-bullet:hover {
background: #666;
}
@media (max-width: 768px) {
.main-container {
height: 100vh;
}
.text-swiper-container {
width: 100%;
z-index: 10;
}
.swiper-slide {
padding: 40px 20px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
}
.static-image-container {
width: 100%;
}
.slide-title {
font-size: 32px;
}
.swiper-navigation {
padding: 20px 0;
gap: 20px;
}
.swiper-button-prev,
.swiper-button-next {
width: 40px;
height: 40px;
}
.swiper-pagination-bullet {
width: 30px;
}
.swiper-pagination-bullet-active {
width: 45px;
}
}
@media (min-width: 1800px) {
.container.container-1770 {
max-width: 1906px !important;
}
}
.full-border {
width: 100% !important;
border-bottom: 1px solid #dedede !important;
box-sizing: border-box !important;
}
</style>
</head>
<body>
<?php include "../ui/nav.php"; ?>
<div class="page-content">
<!-- ==========================================
SECTION A: BANNERS (uses $pdo via fetchBanners)
========================================== -->
<style>
.main-container {
position: relative;
display: flex;
overflow-x: hidden;
padding-top: 30px;
}
.text-swiper-container {
width: 50%;
height: 55vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
flex-direction: column;
}
.swiper-wrapper {
flex: 1;
}
.swiper-slide-1 {
display: flex;
align-items: center;
justify-content: center;
background: white;
padding: 0 0px;
}
.slide-content {
width: 100%;
max-width: 700px;
text-align: center;
}
.slide-tag {
font-size: 14px;
color: #666666;
margin-bottom: 20px;
text-transform: capitalize;
letter-spacing: 1px;
font-weight: 500;
}
.slide-title {
font-size: 35px;
font-weight: 600;
line-height: 1.2;
margin-bottom: 40px;
color: black;
}
.slide-btn {
background: #000;
color: white;
padding: 10px 30px;
border: none;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
text-transform: capitalize;
letter-spacing: 0.5px;
text-decoration: none;
display: inline-block;
}
.slide-btn:hover {
background: #333;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
color: white;
text-decoration: none;
}
.static-image-container {
width: 50%;
height: 60vh;
right: 0;
top: 0;
overflow: hidden;
}
.image-swiper-container {
width: 100%;
height: 100%;
}
.image-slide {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.image-slide img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
margin: 0;
padding: 0;
border: none;
outline: none;
border-radius: 10px;
}
.swiper-navigation {
display: flex;
align-items: center;
justify-content: center;
gap: 40px;
padding-bottom: 40px;
background: white;
}
.swiper-button-prev,
.swiper-button-next {
position: static;
width: 50px;
height: 50px;
background: transparent;
border: 2px solid #ddd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
margin: 0;
}
.swiper-button-prev:hover,
.swiper-button-next:hover {
border-color: #333;
background: #333;
}
.swiper-button-prev::after,
.swiper-button-next::after {
font-size: 16px;
font-weight: bold;
color: #666;
transition: color 0.3s ease;
}
.swiper-button-prev:hover::after,
.swiper-button-next:hover::after {
color: white;
}
.swiper-pagination {
position: static !important;
width: auto !important;
display: flex;
gap: 8px;
align-items: center;
}
.swiper-pagination-bullet {
width: 40px;
height: 2px;
border-radius: 1px;
background: #ddd;
opacity: 1;
transition: all 0.3s ease;
cursor: pointer;
}
.swiper-pagination-bullet-active {
background: #333;
width: 60px;
}
.swiper-pagination-bullet:hover {
background: #666;
}
/* Mobile Responsive - 80vh total height */
@media (max-width: 768px) {
.container-fluid.mt-4 {
margin-top: 0 !important;
}
.main-container {
flex-direction: column;
height: 80vh;
padding-top: 0;
overflow: hidden;
}
/* Image first - 45vh */
.static-image-container {
width: 100%;
height: 45vh;
position: relative;
order: 1;
}
.image-swiper-container {
width: 100%;
height: 100%;
}
.image-slide {
height: 100%;
}
.image-slide img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 0;
}
/* Text content below - 35vh */
.text-swiper-container {
width: 100%;
height: 35vh;
padding: 0;
display: flex;
flex-direction: column;
order: 2;
}
.swiper-wrapper {
flex: 1;
display: flex;
align-items: center;
}
.swiper-slide-1 {
padding: 8px 15px;
display: flex;
align-items: center;
justify-content: center;
}
.slide-content {
padding: 0 10px;
}
.slide-tag {
font-size: 10px;
margin-bottom: 6px;
}
.slide-title {
font-size: 18px;
margin-bottom: 10px;
line-height: 1.2;
}
.slide-btn {
padding: 8px 22px;
font-size: 12px;
}
/* Navigation at bottom */
.swiper-navigation {
padding: 10px 0;
gap: 18px;
height: auto;
flex-shrink: 0;
order: 3;
}
.swiper-button-prev,
.swiper-button-next {
width: 34px;
height: 34px;
}
.swiper-button-prev::after,
.swiper-button-next::after {
font-size: 12px;
}
.swiper-pagination-bullet {
width: 24px;
}
.swiper-pagination-bullet-active {
width: 36px;
}
}
/* Small mobile devices */
@media (max-width: 480px) {
.pb-sm-50 {
margin-bottom: 50px !important;
}
.main-container {
height: 70vh;
}
.static-image-container {
height: 45vh;
}
.text-swiper-container {
height: 32vh;
}
.slide-title {
font-size: 20px;
margin-bottom: 15px;
font-weight:500;
}
body {
padding-top: 102px;
}
.slide-tag {
font-size: 13px;
margin-bottom: 10px;
}
.slide-btn {
padding: 7px 20px;
font-size: 11px;
}
.swiper-navigation {
gap: 9px;
padding: 8px 0;
}
.swiper-button-prev,
.swiper-button-next {
width: 30px;
height: 30px;
}
.swiper-pagination-bullet {
width: 22px;
}
.swiper-pagination-bullet-active {
width: 32px;
}
}
@media (min-width: 1800px) {
.container.container-1770 {
max-width: 1906px !important;
}
}
</style>
<!-- ============================================
CSS STYLES - Add this in your index.php head or style section
============================================ -->
<style>
/* Replace the existing .gender-filter-container styles with: */
.gender-toggle-container {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
gap: 20px;
}
.gender-toggle-btn {
padding: 8px 10px;
background: transparent;
border: none;
font-size: 22px;
font-weight: 700;
color: #666;
cursor: pointer;
transition: color 0.3s ease;
}
.gender-toggle-btn:hover {
color: #000;
}
.gender-toggle-btn.active {
color: #000;
font-size: 15px;
text-decoration: underline;
}
.fashion-grid-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 15px;
padding: 1.5rem 0;
margin: 0 auto;
margin-bottom: 150px;
position: relative;
}
.category-card-wrapper {
position: relative;
height: 384px;
border-radius: 5px;
overflow: hidden;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: none;
}
.category-card-wrapper:hover {
box-shadow: none;
}
.card-background-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.6s ease;
filter: brightness(0.85);
}
.category-card-wrapper:hover .card-background-image {
transform: scale(1.1);
filter: brightness(0.75);
}
.card-overlay-content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 2rem;
color: white;
transition: background 0.3s ease;
}
.category-tag-label {
border-radius: 25px;
font-size: 1.1rem;
font-weight: 500;
align-self: flex-start;
transition: all 0.4s ease;
text-transform: capitalize;
}
.category-card-wrapper:hover .category-tag-label {
transform: translateY(-4px);
}
.card-title-text {
font-size: 18px;
line-height: 1.2;
margin: 0;
transition: transform 0.3s ease;
}
.category-card-wrapper:hover .card-title-text {
transform: translateY(-2px);
}
.special-offer-badge {
background: linear-gradient(45deg, #ff4757, #ff6b7a);
color: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-top: 1rem;
align-self: flex-start;
animation: pulse 2s infinite;
box-shadow: 0 4px 16px rgba(255, 71, 87, 0.4);
}
@keyframes pulse {
0% {
transform: scale(1);
box-shadow: 0 4px 16px rgba(255, 71, 87, 0.4);
}
50% {
transform: scale(1.05);
box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}
100% {
transform: scale(1);
box-shadow: 0 4px 16px rgba(255, 71, 87, 0.4);
}
}
.card-content-bottom {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
/* Progress Bar Container */
.scroll-progress-container {
display: none;
}
@media (max-width: 768px) {
.fashion-grid-container {
display: flex;
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
gap: 1rem;
padding: 1rem;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
margin-bottom: 2.5rem;
margin-top: 20px;
}
.fashion-grid-container::-webkit-scrollbar {
display: none;
}
.card-title-text {
font-size: 1.3rem;
}
.card-overlay-content {
padding: 1.5rem;
}
/* Progress Bar */
.scroll-progress-container {
display: block;
position: relative;
width: 100%;
height: 3px;
background-color: #e0e0e0;
margin: 0 auto;
overflow: hidden;
}
.scroll-progress-bar {
position: absolute;
left: 0;
top: 0;
height: 100%;
background-color: #000;
width: 0%;
transition: width 0.1s ease-out;
}
}
@media (max-width: 480px) {
.fashion-grid-container {
gap: 0.8rem;
padding: 0.8rem;
}
.category-card-wrapper {
min-width: 170px;
max-width: 170px;
height: 220px;
}
.card-title-text {
font-size: 14px;
}
.card-overlay-content {
padding: 1.2rem;
}
.gender-toggle-btn.inactive-btn{
font-size: 24px !important;
}
.ctaegory_heading_h1,.idx-collection-title,.favorites-title-main{
font-size: 24px !important;
}
.mt-smm-40{
margin-top:40px !important;
}
.voh-marquee-wrapper{
padding: 0 0 !important;
}
.customer-favorites-header{
margin-bottom: 20px !important;
}
}
</style>
<!-- Gender Filter Buttons -->
<!-- Replace the existing gender filter container with this: -->
<!-- Replace the existing gender toggle container with this: -->
<!-- Gender Filter Buttons - CORRECTED INITIAL STATE -->
<div class="container-fluid cf-sm-pl-10" style="margin-top:30px;">
<div class="gender-toggle-container">
<button class="gender-toggle-btn inactive-btn" data-gender="Women">WOMEN</button>
<button class="gender-toggle-btn active" data-gender="Men">Shop men</button>
</div>
<div id="productSectionsContainer">
<!-- All product sections will be loaded here -->
</div>
<style>
/* .resale-container {*/
/* display: flex;*/
/* align-items: flex-end;*/
/* background-color: #e9e9e9;*/
/* min-height: 400px;*/
/* margin-bottom: 150px;*/
/* }*/
/* .image-section {*/
/* flex: 0 0 50%;*/
/* display: flex;*/
/* align-items: flex-end;*/
/* justify-content: center;*/
/* height: 100%;*/
/* }*/
/* .cropped-image {*/
/* width: 100%;*/
/* max-width: 500px;*/
/* height: auto;*/
/* display: block;*/
/* }*/
/* .content-section {*/
/* flex: 0 0 50%;*/
/* display: flex;*/
/* flex-direction: column;*/
/* justify-content: center;*/
/* padding: 40px;*/
/* align-self: stretch;*/
/* }*/
/* .main-heading {*/
/* font-size: 2.5rem;*/
/* font-weight: bold;*/
/* margin: 0 0 20px 0;*/
/* color: #000;*/
/* line-height: 1.2;*/
/* }*/
/* .description-text {*/
/* font-size: 1.1rem;*/
/* color: #333;*/
/* margin: 0 0 30px 0;*/
/* line-height: 1.6;*/
/* }*/
/* .cta-button {*/
/* display: inline-flex;*/
/* align-items: center;*/
/* gap: 10px;*/
/* background-color: black;*/
/* color: white;*/
/* font-size: 15px;*/
/* font-weight: 500;*/
/* padding: 9px 22px;*/
/* border-radius: 5px;*/
/* cursor: pointer;*/
/* text-decoration: none;*/
/* transition: transform 0.2s;*/
width: auto; /* 🔹 Ensure button doesn’t stretch */
align-self: flex-start; /* 🔹 Prevent flex parent from making it full width */
/*}*/
/* .cta-button:hover {*/
/* transform: translateX(5px);*/
/* }*/
/* .arrow-icon {*/
/* font-size: 1.2rem;*/
/* }*/
/* @media (max-width: 968px) {*/
/* .resale-container {*/
/* flex-direction: column;*/
/* align-items: center;*/
/* gap: 30px;*/
/* padding: 30px 20px;*/
/* }*/
/* .image-section {*/
/* flex: 0 0 auto;*/
/* max-width: 100%;*/
/* }*/
/* .content-section {*/
/* flex: 0 0 auto;*/
/* align-items: center;*/
/* text-align: center;*/
/* padding: 20px;*/
/* align-self: auto;*/
/* }*/
/* .main-heading {*/
/* font-size: 2rem;*/
/* }*/
/* }*/
/* @media (max-width: 576px) {*/
/* .main-heading {*/
/* font-size: 1.75rem;*/
/* }*/
/* .description-text {*/
/* font-size: 1rem;*/
/* }*/
/* .cta-button {*/
/* align-self: center; */
/* }*/
/* }*/
</style>
<!--<div class="container-fluid">-->
<!--<div class="resale-container">-->
<!-- <div class="image-section">-->
<!-- <img src="img/1920x0.png" alt="Wardrobe resale" class="cropped-image">-->
<!-- </div>-->
<!-- <div class="content-section">-->
<!-- <h2 class="main-heading">GOT TOO MANY CLOTHES?</h2>-->
<!-- <p class="description-text">-->
<!-- Clear some space in your wardrobe. Send us your pre-loved clothes to resell.-->
<!-- </p>-->
<!-- <a href="#" class="cta-button">-->
<!-- <span>Sell your items</span>-->
<!-- <span class="arrow-icon">-->
<!-- <svg class="icon icon-caret-right" width="12" height="12" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">-->
<!-- <path d="M14.6811 9.85967H0L0 8.13441H14.6811L7.77157 1.22488L9 0L18 9L9 18L7.77157 16.7751L14.6811 9.85967Z" fill="#fff"></path>-->
<!-- </svg>-->
<!-- </span>-->
<!--</a>-->
<!-- </div>-->
<!--</div>-->
<!--</div>-->
<!-- Make an Offer Modal -->
<div class="modal fade" id="makeOfferModal" tabindex="-1" aria-labelledby="makeOfferModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="makeOfferModalLabel">Make an Offer</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!-- Auth Section (Login/Register) -->
<div id="authSection" style="display: none;">
<ul class="nav nav-tabs mb-3" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="login-tab" data-bs-toggle="tab"
data-bs-target="#login-panel" type="button">Login</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="register-tab" data-bs-toggle="tab"
data-bs-target="#register-panel" type="button">Register</button>
</li>
</ul>
<div class="tab-content">
<!-- Login Panel -->
<div class="tab-pane fade show active" id="login-panel">
<form id="modalLoginForm">
<div class="mb-3">
<input type="email" class="form-control" name="email" placeholder="Email*" required>
</div>
<div class="mb-3">
<input type="password" class="form-control" name="password" placeholder="Password*" required>
</div>
<button type="submit" class="btn btn-dark w-100">Login & Continue</button>
</form>
</div>
<!-- Register Panel -->
<div class="tab-pane fade" id="register-panel">
<form id="modalRegisterForm">
<div class="row mb-3">
<div class="col-6">
<input type="text" class="form-control" name="fname" placeholder="First Name*" required>
</div>
<div class="col-6">
<input type="text" class="form-control" name="lname" placeholder="Last Name">
</div>
</div>
<div class="mb-3">
<input type="email" class="form-control" name="email" placeholder="Email*" required>
</div>
<div class="mb-3">
<input type="password" class="form-control" name="password" placeholder="Password (min 8 chars)*" required>
</div>
<button type="submit" class="btn btn-dark w-100">Register & Continue</button>
</form>
</div>
</div>
</div>
<!-- Offer Form Section -->
<div id="offerFormSection" style="display: none;">
<div class="alert alert-info mb-3">
<strong id="offerProductName"></strong>
<div class="text-muted small" id="offerVariantInfo"></div>
</div>
<form id="offerForm">
<input type="hidden" name="product_id" id="offerProductId">
<input type="hidden" name="variant_title" id="offerVariantTitle">
<input type="hidden" name="variant_attributes" id="offerVariantAttributes">
<div class="mb-3">
<label class="form-label">Your Email</label>
<input type="email" class="form-control" id="offerEmail" readonly>
</div>
<div class="mb-3">
<label class="form-label">Your Offer Amount (₹) *</label>
<input type="number" step="0.01" min="1" class="form-control"
name="offer_amount" id="offerAmount" placeholder="Enter your offer" required>
<small class="text-muted">Minimum offer: ₹1.00</small>
<div class="mt-2">
<small class="text-muted">Current Price: <strong id="currentPrice"></strong></small>
</div>
</div>
<button type="submit" class="btn btn-dark w-100" id="submitOfferBtn">Submit Offer</button>
</form>
</div>
<!-- Messages -->
<div id="modalMessage" class="mt-3"></div>
</div>
</div>
</div>
</div>
<style>
.modal-content {
border-radius: 12px;
}
.modal-header {
border-bottom: 1px solid #e9ecef;
padding: 20px;
}
.modal-body {
padding: 20px;
}
.nav-tabs .nav-link {
color: #6c757d;
border: none;
border-bottom: 2px solid transparent;
}
.nav-tabs .nav-link.active {
color: #212529;
border-bottom: 2px solid #212529;
background: transparent;
}
#modalMessage .alert {
margin-bottom: 0;
}
</style>
</div>
<?php include "../ui/footer.php"; ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Text content swiper
const textSwiper = new Swiper(".text-swiper-container", {
direction: "horizontal",
loop: true,
speed: 800,
effect: "slide",
pagination: {
el: ".swiper-pagination",
clickable: true,
type: "bullets",
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
slidesPerView: 1,
spaceBetween: 0,
allowTouchMove: false,
});
// Image swiper
const imageSwiper = new Swiper(".image-swiper-container", {
direction: "horizontal",
loop: true,
speed: 800,
effect: "slide",
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
slidesPerView: 1,
spaceBetween: 0,
});
// Sync both swipers
textSwiper.controller.control = imageSwiper;
imageSwiper.controller.control = textSwiper;
// Button demo
document.querySelectorAll(".slide-btn").forEach((btn) => {
btn.addEventListener("click", function () {
console.log("Button clicked:", this.textContent);
});
});
});
</script>
<script>
function ensureSizeSelected(){
var sel = document.getElementById('sizeSelect');
if (!sel) return true; // no size for this product
if (!sel.value) {
alert('Please select a size.');
sel.focus();
return false;
}
return true;
}
</script>
<script>
class FashionCarousel {
constructor() {
this.track = document.getElementById("fashionTrack");
this.prevBtn = document.getElementById("fashionPrevBtn");
this.nextBtn = document.getElementById("fashionNextBtn");
this.progress = document.getElementById("fashionProgress") ||
document.querySelector(".fashion-pagination-progress");
this.cards = document.querySelectorAll(".fashion-product-card");
this.cardWidth = 460; // 440px card width + 20px gap
this.currentIndex = 0;
this.isDragging = false;
this.startX = 0;
this.startTransform = 0;
this.init();
}
init() {
this.updateMaxIndex();
this.updateSlider();
this.setupEventListeners();
window.addEventListener("resize", () => {
this.updateMaxIndex();
this.currentIndex = Math.min(this.currentIndex, this.maxIndex);
this.updateSlider();
});
}
updateMaxIndex() {
const visibleCards = this.getVisibleCards();
this.maxIndex = Math.max(0, this.cards.length - visibleCards);
}
setupEventListeners() {
this.prevBtn.addEventListener("click", (e) => {
if (this.prevBtn.classList.contains("disabled")) {
e.preventDefault();
e.stopPropagation();
return false;
}
this.prev();
});
this.nextBtn.addEventListener("click", (e) => {
if (this.nextBtn.classList.contains("disabled")) {
e.preventDefault();
e.stopPropagation();
return false;
}
this.next();
});
// Mouse drag events
this.track.addEventListener("mousedown", (e) => this.startDrag(e));
document.addEventListener("mousemove", (e) => this.drag(e));
document.addEventListener("mouseup", () => this.endDrag());
// Touch events
this.track.addEventListener("touchstart", (e) => this.startDrag(e.touches[0]));
document.addEventListener("touchmove", (e) => this.drag(e.touches[0]));
document.addEventListener("touchend", () => this.endDrag());
}
startDrag(e) {
this.isDragging = true;
this.startX = e.clientX;
this.startTransform = -this.currentIndex * this.cardWidth;
this.track.classList.add("dragging");
e.preventDefault();
}
drag(e) {
if (!this.isDragging) return;
const deltaX = e.clientX - this.startX;
const newTransform = this.startTransform + deltaX;
this.track.style.transform = `translateX(${newTransform}px)`;
}
endDrag() {
if (!this.isDragging) return;
this.isDragging = false;
this.track.classList.remove("dragging");
const currentTransform = new DOMMatrix(this.track.style.transform).m41;
const threshold = this.cardWidth * 0.2;
const deltaX = currentTransform - this.startTransform;
if (Math.abs(deltaX) > threshold) {
if (deltaX > 0 && this.currentIndex > 0) {
this.currentIndex--;
} else if (deltaX < 0 && this.currentIndex < this.maxIndex) {
this.currentIndex++;
}
}
this.updateSlider();
}
getVisibleCards() {
const containerWidth = this.track.parentElement.offsetWidth;
return Math.floor(containerWidth / this.cardWidth);
}
prev() {
if (this.currentIndex > 0) {
this.currentIndex--;
this.updateSlider();
}
}
next() {
if (this.currentIndex < this.maxIndex) {
this.currentIndex++;
this.updateSlider();
}
}
updateSlider() {
const translateX = -this.currentIndex * this.cardWidth;
this.track.style.transform = `translateX(${translateX}px)`;
this.updateButtons();
this.updateProgress();
}
updateProgress() {
if (!this.progress) return;
let progressPosition;
if (this.maxIndex === 0) {
// Only one page, keep at start
progressPosition = 0;
} else {
// Calculate how far to move the black bar along the gray line
// From 0% (left) to 80% (right, since bar is 20% wide)
progressPosition = (this.currentIndex / this.maxIndex) * 80;
}
// Move the black bar along the gray line using transform
this.progress.style.transform = `translateX(${progressPosition}%)`;
console.log(`Progress moving to: ${progressPosition}% (Index: ${this.currentIndex}/${this.maxIndex})`);
}
updateButtons() {
this.prevBtn.classList.remove("disabled");
this.nextBtn.classList.remove("disabled");
if (this.currentIndex === 0) {
this.prevBtn.classList.add("disabled");
}
if (this.currentIndex >= this.maxIndex) {
this.nextBtn.classList.add("disabled");
}
}
}
// Initialize carousel when DOM is loaded
document.addEventListener("DOMContentLoaded", () => {
new FashionCarousel();
});
</script>
<script>
// Gender filter state
let currentGender = 'all';
// Load products based on gender filter
// Add this function to reinitialize the collection slider after AJAX load
function reinitCollectionSlider() {
const wrapper = document.getElementById('idxCollectionWrapper');
const prevBtn = document.getElementById('idxCollectionPrev');
const nextBtn = document.getElementById('idxCollectionNext');
const pagination = document.getElementById('idxCollectionPagination');
if (!wrapper || !prevBtn || !nextBtn || !pagination) return;
const slides = wrapper.querySelectorAll('.idx-collection-slide');
const totalSlides = slides.length;
if (totalSlides === 0) return;
let currentIndex = 0;
let slidesPerView = window.innerWidth <= 768 ? 1 : 2;
let totalPages = Math.ceil(totalSlides / slidesPerView);
// Remove old event listeners by cloning nodes
const newPrevBtn = prevBtn.cloneNode(true);
const newNextBtn = nextBtn.cloneNode(true);
prevBtn.parentNode.replaceChild(newPrevBtn, prevBtn);
nextBtn.parentNode.replaceChild(newNextBtn, nextBtn);
function createPagination() {
pagination.innerHTML = '';
for (let i = 0; i < totalPages; i++) {
const dot = document.createElement('button');
dot.className = 'idx-pagination-dot';
if (i === 0) dot.classList.add('active');
dot.setAttribute('aria-label', `Go to slide ${i + 1}`);
dot.addEventListener('click', () => goToPage(i));
pagination.appendChild(dot);
}
}
function updatePagination() {
const dots = pagination.querySelectorAll('.idx-pagination-dot');
const currentPage = Math.floor(currentIndex / slidesPerView);
dots.forEach((dot, index) => {
dot.classList.toggle('active', index === currentPage);
});
}
function updateSlider() {
const slideWidth = 100 / slidesPerView;
const translateX = -(currentIndex * slideWidth);
wrapper.style.transform = `translateX(${translateX}%)`;
newPrevBtn.disabled = currentIndex === 0;
newNextBtn.disabled = currentIndex >= totalSlides - slidesPerView;
updatePagination();
}
function goToPage(pageIndex) {
currentIndex = pageIndex * slidesPerView;
currentIndex = Math.max(0, Math.min(currentIndex, totalSlides - slidesPerView));
updateSlider();
}
newPrevBtn.addEventListener('click', () => {
if (currentIndex > 0) {
currentIndex = Math.max(0, currentIndex - slidesPerView);
updateSlider();
}
});
newNextBtn.addEventListener('click', () => {
if (currentIndex < totalSlides - slidesPerView) {
currentIndex = Math.min(totalSlides - slidesPerView, currentIndex + slidesPerView);
updateSlider();
}
});
createPagination();
updateSlider();
}
// Add this function with your other JavaScript functions
function reinitBannerSwiper() {
// Destroy existing swipers if they exist
if (window.textSwiperInstance) {
window.textSwiperInstance.destroy(true, true);
}
if (window.imageSwiperInstance) {
window.imageSwiperInstance.destroy(true, true);
}
// Reinitialize text swiper
window.textSwiperInstance = new Swiper(".text-swiper-container", {
direction: "horizontal",
loop: true,
speed: 800,
effect: "slide",
pagination: {
el: ".swiper-pagination",
clickable: true,
type: "bullets",
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
slidesPerView: 1,
spaceBetween: 0,
allowTouchMove: false,
});
// Reinitialize image swiper
window.imageSwiperInstance = new Swiper(".image-swiper-container", {
direction: "horizontal",
loop: true,
speed: 800,
effect: "slide",
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
slidesPerView: 1,
spaceBetween: 0,
});
// Sync both swipers
window.textSwiperInstance.controller.control = window.imageSwiperInstance;
window.imageSwiperInstance.controller.control = window.textSwiperInstance;
}
// Update the loadProductsByGender function to reinitialize the slider
function loadProductsByGender(gender) {
currentGender = gender;
const container = document.getElementById('productSectionsContainer');
const originalHeight = container.offsetHeight;
container.style.minHeight = originalHeight + 'px';
container.innerHTML = '<div style="text-align:center;padding:50px;"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div></div>';
fetch('load_gender_products.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'gender=' + encodeURIComponent(gender)
})
.then(response => response.text())
.then(html => {
container.innerHTML = html;
container.style.minHeight = '';
setTimeout(function() {
if (typeof window.reinitProductSlider === 'function') {
window.reinitProductSlider();
}
if (typeof initUniversalOfferTimers === 'function') {
initUniversalOfferTimers();
}
reinitCollectionSlider();
reinitBannerSwiper();
initCustomerChoiceCards();
// ✅ ADD THIS LINE
reinitShopTheLook();
}, 200);
})
.catch(error => {
console.error('Error loading products:', error);
container.style.minHeight = '';
container.innerHTML = '<div style="text-align:center;padding:50px;"><p>Error loading products. Please try again.</p></div>';
});
}
// Gender filter button click handlers
// Replace the gender filter JavaScript with this:
// Replace the gender filter JavaScript with this:
// Corrected gender filter JavaScript
document.addEventListener('DOMContentLoaded', function() {
const toggleBtns = document.querySelectorAll('.gender-toggle-btn');
let currentGender = 'Women'; // Initial state is Women
toggleBtns.forEach(btn => {
btn.addEventListener('click', function() {
// Only process clicks on the active (right) button
if (!this.classList.contains('active')) {
return; // Ignore clicks on inactive button
}
const clickedGender = this.dataset.gender;
// Load products for the clicked gender
currentGender = clickedGender;
// Update button states and text
toggleBtns.forEach(b => {
if (b.dataset.gender === clickedGender) {
// This button becomes active (right side)
b.classList.add('active');
b.classList.remove('inactive-btn');
// Show opposite gender with "shop" in lowercase
const oppositeGender = clickedGender === 'Women' ? 'Men' : 'Women';
b.textContent = 'Shop ' + oppositeGender.toLowerCase();
b.dataset.gender = oppositeGender;
} else {
// This button becomes inactive (left side)
b.classList.remove('active');
b.classList.add('inactive-btn');
// Show current gender in UPPERCASE
b.textContent = clickedGender.toUpperCase();
b.dataset.gender = clickedGender;
}
});
// Load products for the new gender
loadProductsByGender(clickedGender);
});
});
// Load Women products initially (matches the initial active state)
loadProductsByGender('Women');
});
/**
* Universal Offer Timer Initialization
* Works for all sections with class "offer-timer-common"
*/
function initUniversalOfferTimers() {
const timers = document.querySelectorAll('.offer-timer-common');
console.log('Found ' + timers.length + ' offer timers');
timers.forEach(timer => {
const timerText = timer.querySelector('.timer-text');
if (!timerText) {
console.log('No timer text element found');
return;
}
const offerEnd = timer.dataset.offerEnd;
if (!offerEnd) {
console.log('No offer end date found');
return;
}
const endTime = new Date(offerEnd).getTime();
function updateTimer() {
const now = Date.now();
const distance = endTime - now;
if (distance < 0) {
timerText.textContent = 'Expired';
timer.style.color = '#999';
// Hide the entire offer price row wrapper when expired
const priceWrapper = timer.closest('.offer-price-row-wrapper');
if (priceWrapper) {
priceWrapper.style.display = 'none';
}
if (timer.intervalId) {
clearInterval(timer.intervalId);
}
return;
}
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
if (days > 0) {
timerText.textContent = `${days}d ${hours}h`;
} else if (hours > 0) {
timerText.textContent = `${hours}h ${minutes}m`;
} else {
timerText.textContent = `${minutes}m`;
timer.classList.add('expiring-soon');
}
}
// Initial update
updateTimer();
// Update every minute
timer.intervalId = setInterval(updateTimer, 60000);
});
}
// Multiple initialization points to ensure timers always work
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function() {
console.log('DOMContentLoaded - initializing timers');
initUniversalOfferTimers();
});
} else {
console.log('DOM already loaded - initializing timers immediately');
initUniversalOfferTimers();
}
// Backup initialization on window load
window.addEventListener('load', function() {
console.log('Window load - initializing timers');
setTimeout(initUniversalOfferTimers, 100);
});
// Re-initialize when Bootstrap tabs are shown (for "More to Love" section)
document.addEventListener('shown.bs.tab', function() {
console.log('Tab shown - re-initializing timers');
setTimeout(initUniversalOfferTimers, 50);
});
</script>
<script>
(function() {
let gridLayout, progressFill;
let scrollTimeout;
let isLooping = false;
function init() {
gridLayout = document.querySelector('.productGridLayout');
progressFill = document.getElementById('collectionProgressFill');
if (!gridLayout || !progressFill) return;
// Only apply on mobile
if (window.innerWidth <= 768) {
cloneProducts();
gridLayout.addEventListener('scroll', handleScroll, { passive: true });
window.addEventListener('resize', handleResize);
updateProgressBar();
}
}
function cloneProducts() {
if (window.innerWidth > 768) {
const clones = gridLayout.querySelectorAll('.cloned');
clones.forEach(clone => clone.remove());
return;
}
const products = Array.from(gridLayout.querySelectorAll('.productCardWrapper:not(.cloned)'));
products.forEach(product => {
const clone = product.cloneNode(true);
clone.classList.add('cloned');
gridLayout.appendChild(clone);
});
products.reverse().forEach(product => {
const clone = product.cloneNode(true);
clone.classList.add('cloned');
gridLayout.insertBefore(clone, gridLayout.firstChild);
});
const productWidth = products[0].offsetWidth;
const gap = 15;
const totalOriginalProducts = products.length;
gridLayout.scrollLeft = (productWidth + gap) * totalOriginalProducts;
}
function handleScroll() {
updateProgressBar();
if (window.innerWidth <= 768) {
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(checkLoop, 50);
}
}
function checkLoop() {
if (isLooping || window.innerWidth > 768) return;
const scrollLeft = gridLayout.scrollLeft;
const product = gridLayout.querySelector('.productCardWrapper:not(.cloned)');
if (!product) return;
const productWidth = product.offsetWidth;
const gap = 15;
const slideWidth = productWidth + gap;
const originalProducts = gridLayout.querySelectorAll('.productCardWrapper:not(.cloned)').length;
const totalWidth = slideWidth * originalProducts;
if (scrollLeft >= totalWidth + slideWidth * originalProducts - 10) {
isLooping = true;
gridLayout.scrollLeft = slideWidth * originalProducts;
setTimeout(() => { isLooping = false; }, 100);
}
if (scrollLeft <= 10) {
isLooping = true;
gridLayout.scrollLeft = slideWidth * originalProducts;
setTimeout(() => { isLooping = false; }, 100);
}
}
function updateProgressBar() {
if (!gridLayout || !progressFill) return;
if (window.innerWidth <= 768) {
const product = gridLayout.querySelector('.productCardWrapper:not(.cloned)');
if (!product) return;
const productWidth = product.offsetWidth;
const gap = 15;
const slideWidth = productWidth + gap;
const originalProducts = gridLayout.querySelectorAll('.productCardWrapper:not(.cloned)').length;
const scrollLeft = gridLayout.scrollLeft;
const startOffset = slideWidth * originalProducts;
const adjustedScroll = scrollLeft - startOffset;
const maxScroll = slideWidth * originalProducts;
let scrollPercent = (adjustedScroll / maxScroll) * 100;
scrollPercent = Math.max(0, Math.min(100, scrollPercent));
progressFill.style.width = scrollPercent + '%';
}
}
function handleResize() {
cloneProducts();
updateProgressBar();
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>
<script>
(function() {
let container, progressContainer;
const totalCards = 4;
let bullets = [];
function init() {
container = document.getElementById('featuresContainer');
progressContainer = document.querySelector('.progress-bar-container');
if (container && progressContainer) {
// Create 4 bullet indicators
progressContainer.innerHTML = '';
for (let i = 0; i < totalCards; i++) {
const bullet = document.createElement('div');
bullet.className = 'progress-bar-fill';
if (i === 0) bullet.classList.add('active');
progressContainer.appendChild(bullet);
bullets.push(bullet);
}
container.addEventListener('scroll', updateProgressBar, { passive: true });
window.addEventListener('resize', updateProgressBar);
updateProgressBar();
}
}
function updateProgressBar() {
if (!container || bullets.length === 0) return;
if (window.innerWidth <= 400) {
const scrollLeft = container.scrollLeft;
const scrollWidth = container.scrollWidth - container.clientWidth;
if (scrollWidth === 0) return;
const scrollPercent = scrollLeft / scrollWidth;
const currentIndex = Math.round(scrollPercent * (totalCards - 1));
// Update active bullet
bullets.forEach((bullet, index) => {
if (index === currentIndex) {
bullet.classList.add('active');
} else {
bullet.classList.remove('active');
}
});
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>
<script>
(function() {
let gridLayout, progressFill;
let scrollTimeout;
let isLooping = false;
function init() {
gridLayout = document.querySelector('.productGridLayout');
progressFill = document.getElementById('collectionProgressFill');
if (!gridLayout || !progressFill) return;
// Only apply on mobile
if (window.innerWidth <= 768) {
cloneProducts();
gridLayout.addEventListener('scroll', handleScroll, { passive: true });
window.addEventListener('resize', handleResize);
updateProgressBar();
}
}
function cloneProducts() {
if (window.innerWidth > 768) {
const clones = gridLayout.querySelectorAll('.cloned');
clones.forEach(clone => clone.remove());
return;
}
const products = Array.from(gridLayout.querySelectorAll('.productCardWrapper:not(.cloned)'));
products.forEach(product => {
const clone = product.cloneNode(true);
clone.classList.add('cloned');
gridLayout.appendChild(clone);
});
products.reverse().forEach(product => {
const clone = product.cloneNode(true);
clone.classList.add('cloned');
gridLayout.insertBefore(clone, gridLayout.firstChild);
});
const productWidth = products[0].offsetWidth;
const gap = 15;
const totalOriginalProducts = products.length;
gridLayout.scrollLeft = (productWidth + gap) * totalOriginalProducts;
}
function handleScroll() {
updateProgressBar();
if (window.innerWidth <= 768) {
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(checkLoop, 50);
}
}
function checkLoop() {
if (isLooping || window.innerWidth > 768) return;
const scrollLeft = gridLayout.scrollLeft;
const product = gridLayout.querySelector('.productCardWrapper:not(.cloned)');
if (!product) return;
const productWidth = product.offsetWidth;
const gap = 15;
const slideWidth = productWidth + gap;
const originalProducts = gridLayout.querySelectorAll('.productCardWrapper:not(.cloned)').length;
const totalWidth = slideWidth * originalProducts;
if (scrollLeft >= totalWidth + slideWidth * originalProducts - 10) {
isLooping = true;
gridLayout.scrollLeft = slideWidth * originalProducts;
setTimeout(() => { isLooping = false; }, 100);
}
if (scrollLeft <= 10) {
isLooping = true;
gridLayout.scrollLeft = slideWidth * originalProducts;
setTimeout(() => { isLooping = false; }, 100);
}
}
function updateProgressBar() {
if (!gridLayout || !progressFill) return;
if (window.innerWidth <= 768) {
const product = gridLayout.querySelector('.productCardWrapper:not(.cloned)');
if (!product) return;
const productWidth = product.offsetWidth;
const gap = 15;
const slideWidth = productWidth + gap;
const originalProducts = gridLayout.querySelectorAll('.productCardWrapper:not(.cloned)').length;
const scrollLeft = gridLayout.scrollLeft;
const startOffset = slideWidth * originalProducts;
const adjustedScroll = scrollLeft - startOffset;
const maxScroll = slideWidth * originalProducts;
let scrollPercent = (adjustedScroll / maxScroll) * 100;
scrollPercent = Math.max(0, Math.min(100, scrollPercent));
progressFill.style.width = scrollPercent + '%';
}
}
function handleResize() {
cloneProducts();
updateProgressBar();
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>
<script>
(function() {
function init() {
// Scroll active tab into view on mobile
if (window.innerWidth <= 768) {
const activeTab = document.querySelector('.nav-pills .nav-link.active');
if (activeTab) {
setTimeout(() => {
activeTab.scrollIntoView({
behavior: 'auto',
block: 'nearest',
inline: 'start'
});
}, 150);
}
}
// Handle tab clicks - scroll clicked tab into view
const navLinks = document.querySelectorAll('.nav-pills .nav-link');
navLinks.forEach(link => {
link.addEventListener('click', function() {
if (window.innerWidth <= 768) {
setTimeout(() => {
this.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
inline: 'start'
});
}, 100);
}
});
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>
<script>
// Fixed slider initialization that works with AJAX loaded content
(function() {
let sliderViewport, progressFill, sliderTrack, prevBtn, nextBtn;
let currentIndex = 0;
let isDragging = false;
let startPos = 0;
let currentTranslate = 0;
let prevTranslate = 0;
let animationID = 0;
let scrollTimeout;
let isLooping = false;
let isMobile = false;
let initialized = false;
// Main initialization function
function initSlider() {
sliderViewport = document.getElementById('sliderViewport');
progressFill = document.getElementById('progressFill');
sliderTrack = document.getElementById('sliderTrack');
prevBtn = document.getElementById('prevBtn');
nextBtn = document.getElementById('nextBtn');
if (!sliderViewport || !progressFill || !sliderTrack) {
console.log('Slider elements not found, retrying...');
return false;
}
// Check if slider has products
const slides = sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)');
if (slides.length === 0) {
console.log('No slides found');
return false;
}
isMobile = window.innerWidth <= 400;
// Setup based on device type
setupSlider();
// Event listeners
window.addEventListener('resize', debounce(handleResize, 250));
// Desktop navigation
if (prevBtn && nextBtn) {
prevBtn.addEventListener('click', showPrevSlide);
nextBtn.addEventListener('click', showNextSlide);
}
initialized = true;
console.log('Slider initialized successfully');
return true;
}
function setupSlider() {
cleanup();
isMobile = window.innerWidth <= 400;
if (isMobile) {
setupMobileSlider();
} else {
setupDesktopSlider();
}
updateProgressBar();
}
function setupMobileSlider() {
sliderViewport.style.overflowX = 'auto';
sliderViewport.style.scrollSnapType = 'x mandatory';
sliderTrack.style.transform = 'none';
sliderTrack.style.transition = 'none';
const slides = sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)');
slides.forEach(slide => {
slide.style.scrollSnapAlign = 'start';
});
requestAnimationFrame(() => {
cloneSlidesForMobile();
requestAnimationFrame(() => {
const slideWidth = slides[0]?.offsetWidth || 0;
const totalOriginalSlides = slides.length;
sliderViewport.scrollLeft = slideWidth * totalOriginalSlides;
});
});
sliderViewport.addEventListener('scroll', handleMobileScroll, { passive: true });
}
function setupDesktopSlider() {
sliderViewport.style.overflowX = 'hidden';
sliderViewport.style.scrollSnapType = 'none';
const slides = sliderTrack.querySelectorAll('.product-slide-item');
slides.forEach(slide => {
slide.style.scrollSnapAlign = 'none';
});
const clones = sliderTrack.querySelectorAll('.cloned');
clones.forEach(clone => clone.remove());
currentIndex = 0;
sliderTrack.style.transition = 'transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)';
updateSliderPosition();
sliderTrack.addEventListener('mousedown', dragStart);
sliderTrack.addEventListener('touchstart', dragStart, { passive: false });
sliderTrack.addEventListener('mouseup', dragEnd);
sliderTrack.addEventListener('touchend', dragEnd);
sliderTrack.addEventListener('mouseleave', dragEnd);
sliderTrack.addEventListener('mousemove', drag);
sliderTrack.addEventListener('touchmove', drag, { passive: false });
sliderTrack.style.cursor = 'grab';
}
function cloneSlidesForMobile() {
const existingClones = sliderTrack.querySelectorAll('.cloned');
existingClones.forEach(clone => clone.remove());
const slides = Array.from(sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)'));
if (slides.length === 0) return;
slides.forEach(slide => {
const clone = slide.cloneNode(true);
clone.classList.add('cloned');
sliderTrack.appendChild(clone);
});
slides.slice().reverse().forEach(slide => {
const clone = slide.cloneNode(true);
clone.classList.add('cloned');
sliderTrack.insertBefore(clone, sliderTrack.firstChild);
});
}
function handleMobileScroll() {
if (!isMobile) return;
updateProgressBar();
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(checkLoop, 50);
}
function checkLoop() {
if (isLooping || !isMobile) return;
const scrollLeft = sliderViewport.scrollLeft;
const slides = sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)');
if (slides.length === 0) return;
const slideWidth = slides[0].offsetWidth;
const originalSlides = slides.length;
const totalWidth = slideWidth * originalSlides;
if (scrollLeft >= totalWidth + slideWidth * originalSlides - slideWidth / 2) {
isLooping = true;
sliderViewport.scrollLeft = slideWidth * originalSlides;
setTimeout(() => { isLooping = false; }, 100);
}
if (scrollLeft <= slideWidth / 2) {
isLooping = true;
sliderViewport.scrollLeft = slideWidth * originalSlides;
setTimeout(() => { isLooping = false; }, 100);
}
}
function handleResize() {
const wasMobile = isMobile;
isMobile = window.innerWidth <= 400;
if (wasMobile !== isMobile) {
currentIndex = 0;
setupSlider();
} else {
updateSliderPosition();
updateProgressBar();
}
}
function cleanup() {
if (sliderViewport) {
const newViewport = sliderViewport.cloneNode(false);
while (sliderViewport.firstChild) {
newViewport.appendChild(sliderViewport.firstChild);
}
sliderViewport.parentNode.replaceChild(newViewport, sliderViewport);
sliderViewport = newViewport;
}
if (sliderTrack) {
const newTrack = sliderTrack.cloneNode(false);
const slides = Array.from(sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)'));
slides.forEach(slide => newTrack.appendChild(slide));
sliderTrack.parentNode.replaceChild(newTrack, sliderTrack);
sliderTrack = newTrack;
}
}
function getSlideWidth() {
const slides = sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)');
if (slides.length === 0) return 0;
const slideWidth = slides[0].offsetWidth;
const gap = parseInt(getComputedStyle(sliderTrack).gap) || 8;
return slideWidth + gap;
}
function getTotalSlides() {
return sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)').length;
}
function getVisibleSlides() {
if (window.innerWidth <= 400) return 2;
if (window.innerWidth <= 768) return 3;
if (window.innerWidth <= 1024) return 3;
return 4;
}
function showNextSlide() {
if (isMobile) return;
const totalSlides = getTotalSlides();
const visibleSlides = getVisibleSlides();
const maxIndex = Math.max(0, totalSlides - visibleSlides);
currentIndex = (currentIndex + 1) > maxIndex ? 0 : currentIndex + 1;
updateSliderPosition();
updateProgressBar();
}
function showPrevSlide() {
if (isMobile) return;
const totalSlides = getTotalSlides();
const visibleSlides = getVisibleSlides();
const maxIndex = Math.max(0, totalSlides - visibleSlides);
currentIndex = (currentIndex - 1) < 0 ? maxIndex : currentIndex - 1;
updateSliderPosition();
updateProgressBar();
}
function updateSliderPosition() {
if (isMobile) return;
const slideWidth = getSlideWidth();
const offset = -currentIndex * slideWidth;
sliderTrack.style.transform = `translateX(${offset}px)`;
currentTranslate = offset;
prevTranslate = offset;
}
function updateProgressBar() {
if (!sliderViewport || !progressFill) return;
if (isMobile) {
const slides = sliderTrack.querySelectorAll('.product-slide-item:not(.cloned)');
if (slides.length === 0) return;
const slideWidth = slides[0].offsetWidth;
const originalSlides = slides.length;
const scrollLeft = sliderViewport.scrollLeft;
const startOffset = slideWidth * originalSlides;
const adjustedScroll = Math.max(0, scrollLeft - startOffset);
const maxScroll = slideWidth * originalSlides;
let scrollPercent = maxScroll > 0 ? (adjustedScroll / maxScroll) * 100 : 0;
scrollPercent = Math.max(0, Math.min(100, scrollPercent));
progressFill.style.width = scrollPercent + '%';
} else {
const totalSlides = getTotalSlides();
const visibleSlides = getVisibleSlides();
const maxIndex = Math.max(0, totalSlides - visibleSlides);
if (maxIndex <= 0) {
progressFill.style.width = '100%';
return;
}
const progressPercent = (currentIndex / maxIndex) * 100;
progressFill.style.width = Math.max(0, Math.min(100, progressPercent)) + '%';
}
}
function dragStart(e) {
if (isMobile) return;
isDragging = true;
sliderTrack.classList.add('dragging');
startPos = getPositionX(e);
sliderTrack.style.transition = 'none';
animationID = requestAnimationFrame(animation);
sliderTrack.style.cursor = 'grabbing';
if (e.type === 'touchstart') {
e.preventDefault();
}
}
function drag(e) {
if (!isDragging || isMobile) return;
const currentPosition = getPositionX(e);
currentTranslate = prevTranslate + currentPosition - startPos;
if (e.type === 'touchmove') {
e.preventDefault();
}
}
function dragEnd() {
if (!isDragging || isMobile) return;
isDragging = false;
sliderTrack.classList.remove('dragging');
cancelAnimationFrame(animationID);
sliderTrack.style.transition = 'transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)';
const movedBy = currentTranslate - prevTranslate;
const slideWidth = getSlideWidth();
const threshold = slideWidth / 3;
if (movedBy < -threshold) {
showNextSlide();
} else if (movedBy > threshold) {
showPrevSlide();
} else {
updateSliderPosition();
}
sliderTrack.style.cursor = 'grab';
}
function getPositionX(e) {
return e.type.includes('mouse') ? e.pageX : e.touches[0].clientX;
}
function animation() {
if (!isDragging) return;
sliderTrack.style.transform = `translateX(${currentTranslate}px)`;
requestAnimationFrame(animation);
}
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
// Try to initialize immediately
function tryInit() {
if (initSlider()) {
return;
}
// If failed, keep trying for up to 3 seconds
let attempts = 0;
const maxAttempts = 30;
const interval = setInterval(() => {
attempts++;
if (initSlider() || attempts >= maxAttempts) {
clearInterval(interval);
if (attempts >= maxAttempts) {
console.log('Failed to initialize slider after maximum attempts');
}
}
}, 100);
}
// Multiple initialization triggers
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', tryInit);
} else {
tryInit();
}
// Also try after a short delay in case content is loaded dynamically
setTimeout(tryInit, 500);
setTimeout(tryInit, 1000);
// Expose a global reinit function for AJAX callbacks
window.reinitProductSlider = function() {
console.log('Reinitializing slider...');
initialized = false;
setTimeout(tryInit, 100);
};
})();
</script>
<script>
function initCustomerChoiceCards() {
console.log('=== INIT CUSTOMER CHOICE CARDS START ===');
const imageCards = document.querySelectorAll('.cc-image-card');
const detailsContent = document.getElementById('ccDetailsContent');
console.log('Found image cards:', imageCards.length);
console.log('Details content element:', detailsContent);
if (!imageCards.length) {
console.error('❌ No image cards found!');
return;
}
if (!detailsContent) {
console.error('❌ Details content element not found!');
return;
}
console.log('✅ Starting to attach click handlers...');
imageCards.forEach((card, index) => {
console.log(`Processing card ${index + 1}:`, card);
// REMOVE OR COMMENT OUT THESE LINES:
// if (card.dataset.initialized === 'true') {
// console.log(`Card ${index + 1} already initialized, skipping`);
// return;
// }
// REMOVE THIS LINE TOO:
// card.dataset.initialized = 'true';
// Check if card has product data
if (!card.dataset.product) {
console.error(`❌ Card ${index + 1} has no product data!`);
return;
}
// Rest of your code stays the same...
card.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
console.log('=== CARD CLICKED ===');
console.log('Raw product data:', this.dataset.product);
// Remove active from all cards
const allCards = document.querySelectorAll('.cc-image-card');
allCards.forEach(c => c.classList.remove('active'));
// Add active to clicked card
this.classList.add('active');
console.log('✅ Active class updated');
// Get product data from data attribute
let productData;
try {
productData = JSON.parse(this.dataset.product);
console.log('✅ Parsed product data:', productData);
} catch (err) {
console.error('❌ Error parsing product data:', err);
console.error('Raw data was:', this.dataset.product);
return;
}
// Validate product data
if (!productData.pname || !productData.pid) {
console.error('❌ Invalid product data - missing pname or pid:', productData);
return;
}
// Build product URL
const productSlug = productData.pname.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
const variantSlug = (productData.vname || '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
const detailsUrl = `product_details.php?product=${productSlug}&variant=${variantSlug}&pid=${productData.pid}`;
console.log('✅ Details URL:', detailsUrl);
// Build price HTML
let priceHTML = '';
if (productData.has_offer && productData.offer_end) {
console.log('Building offer price HTML');
priceHTML = `
<div class="offer-price-row-wrapper" style="justify-content: center;">
<div class="cc-price offer-price-common">₹${parseFloat(productData.price).toLocaleString('en-IN', {minimumFractionDigits: 2, maximumFractionDigits: 2})}</div>
<div class="offer-timer-common" data-offer-end="${productData.offer_end}">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
`;
} else {
console.log('Building regular price HTML');
priceHTML = `<div class="cc-price">₹${parseFloat(productData.price).toLocaleString('en-IN', {minimumFractionDigits: 2, maximumFractionDigits: 2})}</div>`;
}
// Update details panel
const detailsPanel = document.getElementById('ccDetailsContent');
if (!detailsPanel) {
console.error('❌ Details panel not found when trying to update!');
return;
}
console.log('Updating details panel...');
detailsPanel.innerHTML = `
<div class="cc-category">${productData.category || 'Product'}</div>
<h2 class="cc-title">${productData.pname}</h2>
<div class="cc-price-section">${priceHTML}</div>
<div class="cc-tax-info">Tax included. Shipping calculated at checkout.</div>
<a href="${detailsUrl}" class="cc-view-btn">View Full Details</a>
`;
console.log('✅ Details panel HTML updated');
// Reinitialize offer timers
if (typeof initUniversalOfferTimers === 'function') {
console.log('Scheduling timer reinitialization...');
requestAnimationFrame(() => {
setTimeout(() => {
console.log('Running initUniversalOfferTimers...');
try {
initUniversalOfferTimers();
console.log('✅ Offer timers reinitialized successfully');
} catch (err) {
console.error('❌ Error reinitializing timers:', err);
}
}, 100);
});
} else {
console.warn('⚠️ initUniversalOfferTimers function not found');
}
console.log('=== CARD CLICK COMPLETE ===');
});
console.log(`✅ Click handler attached to card ${index + 1}`);
});
console.log('=== INIT CUSTOMER CHOICE CARDS COMPLETE ===');
}
// Initialize when DOM is ready
console.log('Document ready state:', document.readyState);
if (document.readyState === 'loading') {
console.log('Adding DOMContentLoaded listener...');
document.addEventListener('DOMContentLoaded', function() {
console.log('DOMContentLoaded fired');
initCustomerChoiceCards();
});
} else {
console.log('DOM already loaded, initializing immediately');
initCustomerChoiceCards();
}
// Also try after delays for dynamic content
setTimeout(function() {
console.log('Running 500ms delayed init...');
initCustomerChoiceCards();
}, 500);
setTimeout(function() {
console.log('Running 1000ms delayed init...');
initCustomerChoiceCards();
}, 1000);
</script>
<script>
// ====== CUSTOMER CHOICE MAKE AN OFFER FUNCTIONALITY ======
// Initialize offer modal handlers
document.addEventListener('DOMContentLoaded', function() {
// Handle all "Make an Offer" buttons in Customer Choice section
document.addEventListener('click', function(e) {
if (e.target.closest('.cc-make-offer-btn')) {
const btn = e.target.closest('.cc-make-offer-btn');
handleCustomerChoiceOfferClick(btn);
}
});
});
function handleCustomerChoiceOfferClick(btn) {
const productId = btn.dataset.productId;
const productName = btn.dataset.productName;
const variantName = btn.dataset.variantName || '';
const productPrice = btn.dataset.productPrice || '0';
// Check if user is logged in
const isUserLoggedIn = <?php echo isset($_SESSION['user_id']) ? 'true' : 'false'; ?>;
if (!isUserLoggedIn) {
// Show login/register section
showAuthSection();
} else {
// Show offer form
showOfferFormForCustomerChoice(productId, productName, variantName, productPrice);
}
// Show modal
if (typeof makeOfferModal !== 'undefined') {
makeOfferModal.show();
} else {
// Initialize modal if not already done
const modalElement = document.getElementById('makeOfferModal');
if (modalElement) {
makeOfferModal = new bootstrap.Modal(modalElement);
makeOfferModal.show();
}
}
}
function showOfferFormForCustomerChoice(productId, productName, variantName, productPrice) {
document.getElementById('authSection').style.display = 'none';
document.getElementById('offerFormSection').style.display = 'block';
// Set product info
document.getElementById('offerProductId').value = productId;
document.getElementById('offerProductName').textContent = productName;
document.getElementById('offerVariantTitle').value = variantName;
document.getElementById('currentPrice').textContent = '₹' + parseFloat(productPrice).toFixed(2);
// Set variant info display
const variantInfo = variantName ? `Variant: ${variantName}` : 'Standard Product';
document.getElementById('offerVariantInfo').textContent = variantInfo;
// Set user email
const userEmail = '<?php echo isset($_SESSION['user_email']) ? $_SESSION['user_email'] : ''; ?>';
document.getElementById('offerEmail').value = userEmail;
// Set empty variant attributes (since customer choice doesn't have detailed attributes)
document.getElementById('offerVariantAttributes').value = '{}';
}
// Update the existing initCustomerChoiceCards function to handle button updates
function initCustomerChoiceCards() {
console.log('=== INIT CUSTOMER CHOICE CARDS START ===');
const imageCards = document.querySelectorAll('.cc-image-card');
const detailsContent = document.getElementById('ccDetailsContent');
if (!imageCards.length || !detailsContent) {
console.log('No cards or details content found');
return;
}
imageCards.forEach((card, index) => {
card.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
// Remove active from all cards
const allCards = document.querySelectorAll('.cc-image-card');
allCards.forEach(c => c.classList.remove('active'));
// Add active to clicked card
this.classList.add('active');
// Get product data
let productData;
try {
productData = JSON.parse(this.dataset.product);
} catch (err) {
console.error('Error parsing product data:', err);
return;
}
// Build URLs
const productSlug = productData.pname.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
const variantSlug = (productData.vname || '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
const detailsUrl = `product_details.php?product=${productSlug}&variant=${variantSlug}&pid=${productData.pid}`;
// Build price HTML
let priceHTML = '';
if (productData.has_offer && productData.offer_end) {
priceHTML = `
<div class="offer-price-row-wrapper" style="justify-content: center;">
<div class="cc-price offer-price-common">₹${parseFloat(productData.price).toLocaleString('en-IN', {minimumFractionDigits: 2, maximumFractionDigits: 2})}</div>
<div class="offer-timer-common" data-offer-end="${productData.offer_end}">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
`;
} else {
priceHTML = `<div class="cc-price">₹${parseFloat(productData.price).toLocaleString('en-IN', {minimumFractionDigits: 2, maximumFractionDigits: 2})}</div>`;
}
// Build buttons HTML
let buttonsHTML = '';
if (productData.has_offer) {
buttonsHTML = `
<div class="cc-action-buttons-split">
<a href="${detailsUrl}" class="cc-view-btn-split">View Details</a>
<button class="cc-offer-btn-split offer-active-btn" disabled>
<i class="fa fa-check-circle"></i> Offer Active
</button>
</div>
`;
} else {
buttonsHTML = `
<div class="cc-action-buttons-split">
<a href="${detailsUrl}" class="cc-view-btn-split">View Details</a>
<button class="cc-offer-btn-split cc-make-offer-btn"
data-product-id="${productData.pid}"
data-product-name="${productData.pname}"
data-variant-name="${productData.vname || ''}"
data-product-price="${productData.price}">
<i class="fa fa-tags"></i> Make Offer
</button>
</div>
`;
}
// Update details panel
const detailsPanel = document.getElementById('ccDetailsContent');
detailsPanel.innerHTML = `
<div class="cc-category">${productData.category || 'Product'}</div>
<h2 class="cc-title">${productData.pname}</h2>
<div class="cc-price-section">${priceHTML}</div>
<div class="cc-tax-info">Tax included. Shipping calculated at checkout.</div>
${buttonsHTML}
`;
// Reinitialize timers
if (typeof initUniversalOfferTimers === 'function') {
requestAnimationFrame(() => {
setTimeout(() => {
initUniversalOfferTimers();
}, 100);
});
}
});
});
console.log('=== INIT CUSTOMER CHOICE CARDS COMPLETE ===');
}
// ====== MAKE AN OFFER FUNCTIONALITY (ADD THIS TO INDEX.PHP) ======
const isUserLoggedIn = <?php echo isset($_SESSION['user_id']) ? 'true' : 'false'; ?>;
const userEmail = '<?php echo isset($_SESSION['user_email']) ? $_SESSION['user_email'] : ''; ?>';
const userName = '<?php echo isset($_SESSION['user_name']) ? $_SESSION['user_name'] : ''; ?>';
let makeOfferModal;
// Initialize modal when DOM is ready
document.addEventListener('DOMContentLoaded', function() {
makeOfferModal = new bootstrap.Modal(document.getElementById('makeOfferModal'));
// Modal login form submit
const modalLoginForm = document.getElementById('modalLoginForm');
if (modalLoginForm) {
modalLoginForm.addEventListener('submit', handleModalLogin);
}
// Modal register form submit
const modalRegisterForm = document.getElementById('modalRegisterForm');
if (modalRegisterForm) {
modalRegisterForm.addEventListener('submit', handleModalRegister);
}
// Offer form submit
const offerForm = document.getElementById('offerForm');
if (offerForm) {
offerForm.addEventListener('submit', handleOfferSubmit);
}
});
function handleCustomerChoiceOfferClick(btn) {
const productId = btn.dataset.productId;
const productName = btn.dataset.productName;
const variantName = btn.dataset.variantName || '';
const productPrice = btn.dataset.productPrice || '0';
const modalMessage = document.getElementById('modalMessage');
if (modalMessage) modalMessage.innerHTML = '';
if (!isUserLoggedIn) {
showAuthSection();
} else {
showOfferFormForCustomerChoice(productId, productName, variantName, productPrice);
}
makeOfferModal.show();
}
function showAuthSection() {
document.getElementById('authSection').style.display = 'block';
document.getElementById('offerFormSection').style.display = 'none';
}
function showOfferFormForCustomerChoice(productId, productName, variantName, productPrice) {
document.getElementById('authSection').style.display = 'none';
document.getElementById('offerFormSection').style.display = 'block';
document.getElementById('offerProductId').value = productId;
document.getElementById('offerProductName').textContent = productName;
document.getElementById('offerVariantTitle').value = variantName;
document.getElementById('currentPrice').textContent = '₹' + parseFloat(productPrice).toFixed(2);
document.getElementById('offerVariantInfo').textContent = variantName ? `Variant: ${variantName}` : 'Standard Product';
document.getElementById('offerEmail').value = userEmail;
document.getElementById('offerVariantAttributes').value = '{}';
}
function handleModalLogin(e) {
e.preventDefault();
const formData = new FormData(e.target);
formData.append('action', 'Login');
showModalMessage('Logging in...', 'info');
fetch('ajax_login.php', {
method: 'POST',
body: formData
})
.then(r => r.json())
.then(data => {
if (data.status === 'ok') {
showModalMessage('Login successful! Reloading...', 'success');
setTimeout(() => location.reload(), 1000);
} else {
showModalMessage(data.message || 'Login failed', 'danger');
}
})
.catch(err => {
console.error('Login error:', err);
showModalMessage('An error occurred. Please try again.', 'danger');
});
}
function handleModalRegister(e) {
e.preventDefault();
const formData = new FormData(e.target);
formData.append('action', 'Insert');
showModalMessage('Creating account...', 'info');
fetch('ajax_user.php', {
method: 'POST',
body: formData
})
.then(r => r.json())
.then(data => {
if (data.status === 'ok') {
showModalMessage('Account created! Reloading...', 'success');
setTimeout(() => location.reload(), 1000);
} else {
showModalMessage(data.message || 'Registration failed', 'danger');
}
})
.catch(err => {
console.error('Registration error:', err);
showModalMessage('An error occurred. Please try again.', 'danger');
});
}
function handleOfferSubmit(e) {
e.preventDefault();
const submitBtn = document.getElementById('submitOfferBtn');
const originalText = submitBtn.textContent;
submitBtn.textContent = 'Submitting...';
submitBtn.disabled = true;
const formData = new FormData(e.target);
const productId = document.getElementById('offerProductId').value;
if (!formData.has('product_id') || !formData.get('product_id')) {
formData.set('product_id', productId);
}
fetch('ajax_make_offer.php', {
method: 'POST',
body: formData
})
.then(r => r.json())
.then(data => {
if (data.success) {
showModalMessage(data.message || 'Offer submitted successfully!', 'success');
e.target.reset();
setTimeout(() => {
makeOfferModal.hide();
location.reload(); // Reload to show pending offer status
}, 1500);
} else {
showModalMessage(data.message || 'Failed to submit offer', 'danger');
}
})
.catch(err => {
console.error('Offer submission error:', err);
showModalMessage('An error occurred. Please try again.', 'danger');
})
.finally(() => {
submitBtn.textContent = originalText;
submitBtn.disabled = false;
});
}
function showModalMessage(message, type) {
const modalMessage = document.getElementById('modalMessage');
if (modalMessage) {
modalMessage.innerHTML = `<div class="alert alert-${type}">${message}</div>`;
}
}
</script>
<script>
// Initialize Shop the Look functionality
function initShopTheLook() {
const shopButton = document.getElementById("shopButton");
const lookOverlay = document.getElementById("lookOverlay");
const productList = document.getElementById("productList");
const closeButton = document.querySelector(".closeButtonIcon");
if (!shopButton || !lookOverlay || !productList) {
console.log('Shop the Look elements not found');
return;
}
// Remove old event listeners by cloning and replacing
const newShopButton = shopButton.cloneNode(true);
shopButton.parentNode.replaceChild(newShopButton, shopButton);
const newCloseButton = closeButton ? closeButton.cloneNode(true) : null;
if (closeButton && newCloseButton) {
closeButton.parentNode.replaceChild(newCloseButton, closeButton);
}
// Shop button click - Toggle expand/collapse
newShopButton.addEventListener("click", function(e) {
e.preventDefault();
e.stopPropagation();
lookOverlay.classList.toggle("expandedState");
productList.classList.toggle("expandedState");
});
// Close button click
if (newCloseButton) {
newCloseButton.addEventListener("click", function(e) {
e.preventDefault();
e.stopPropagation();
lookOverlay.classList.remove("expandedState");
productList.classList.remove("expandedState");
});
}
// Product item click handlers (for logging/tracking)
const productItems = document.querySelectorAll(".individualProductItem");
productItems.forEach((item) => {
item.addEventListener("click", function(e) {
// Link will handle navigation, this is just for tracking
console.log("Product clicked:", this.querySelector(".productItemName").textContent);
});
});
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
initShopTheLook();
});
// Reinitialize after AJAX load
function reinitShopTheLook() {
setTimeout(function() {
initShopTheLook();
}, 300);
}
</script>
</body>
</html>
<!--load_gender_products.php-->
<?php
session_start();
require_once __DIR__ . '/../config/config.php';
try {
$pdo = new PDO(
"mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8mb4",
DB_USER,
DB_PASS,
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]
);
} catch (PDOException $e) {
die("❌ Database connection failed: " . htmlspecialchars($e->getMessage()));
}
// Get gender filter
$gender = isset($_POST['gender']) ? $_POST['gender'] : 'all';
function fetchCategories(PDO $pdo): array {
$sql = "SELECT category, pthumb, pdes FROM products WHERE status IN ('approved','published') GROUP BY category ORDER BY category ASC LIMIT 5";
try {
$stmt = $pdo->prepare($sql);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
error_log("fetchCategories error: " . $e->getMessage());
return [];
}
}
function fetchBanners(PDO $pdo, $gender = 'all'): array {
if ($gender === 'all') {
$sql = "SELECT id, img, titke, des FROM banner WHERE img IS NOT NULL AND img <> '' ORDER BY id DESC";
$stmt = $pdo->prepare($sql);
$stmt->execute();
} else {
$sql = "SELECT id, img, titke, des FROM banner WHERE img IS NOT NULL AND img <> '' AND cid = ? ORDER BY id DESC";
$stmt = $pdo->prepare($sql);
$stmt->execute([$gender]);
}
return $stmt->fetchAll();
}
$bannerUrlBase = '../Images/Setting';
$banners = fetchBanners($pdo, $gender);
$categories1 = fetchCategories($pdo, $gender);
// Helper functions
function makeUrl($string) {
return strtolower(str_replace(' ', '-', preg_replace('/[^A-Za-z0-9 ]/', '', $string)));
}
function firstFromPimg(?string $pimg): string {
if (empty($pimg)) return '';
$decoded = json_decode($pimg, true);
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded) && !empty($decoded[0])) {
return trim($decoded[0]);
}
$parts = array_values(array_filter(array_map('trim', explode(',', $pimg))));
return !empty($parts) ? $parts[0] : '';
}
function getFirstGalleryImage(PDO $pdo, int $pid, ?string $pimg): ?string {
$p = firstFromPimg($pimg);
if ($p !== '') return $p;
$st = $pdo->prepare("SELECT image_path, variant_data FROM product_variations WHERE PID = ? ORDER BY price ASC");
$st->execute([$pid]);
while ($v = $st->fetch()) {
if (!empty($v['image_path'])) return trim($v['image_path']);
if (!empty($v['variant_data'])) {
$vd = json_decode($v['variant_data'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($vd)) {
if (!empty($vd['image'])) return trim($vd['image']);
if (!empty($vd['gallery']) && is_array($vd['gallery'])) {
foreach ($vd['gallery'] as $g) if (!empty($g)) return trim($g);
}
}
}
}
return null;
}
$imageUrl = '../Images/Product';
// Build WHERE clause based on gender
$genderWhere = "";
if ($gender !== 'all') {
$genderWhere = "AND p.category = :gender";
}
// ========== SECTION 1: New & Noteworthy ==========
$sql1 = "SELECT p.pid AS PID, p.pname AS PNAME, p.pthumb AS THUMBNAIL, p.pimg AS PIMG, p.pdes AS PDES, p.category AS CNAME,
(SELECT pv.variant_title FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS VNAME,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS NEW_PRICE,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price DESC LIMIT 1) AS OLD_PRICE,
o.offer_id AS OFFER_ID, o.offer_amount AS OFFER_PRICE, o.offer_valid_until AS OFFER_VALID_UNTIL
FROM products p
LEFT JOIN tbl_offers o ON o.product_id = p.pid AND o.status = 'accepted' AND o.offer_valid_until > NOW()
" . (isset($_SESSION['user_id']) ? "AND o.user_id = " . (int)$_SESSION['user_id'] : "AND 1=0") . "
WHERE p.status IN ('approved','published') $genderWhere
ORDER BY p.pid DESC LIMIT 3";
$stmt1 = $pdo->prepare($sql1);
if ($gender !== 'all') {
$stmt1->bindValue(':gender', $gender);
}
$stmt1->execute();
$products = $stmt1->fetchAll();
foreach ($products as &$row) {
$row['SINGLE_THUMB'] = firstFromPimg($row['PIMG'] ?? null);
$hover = getFirstGalleryImage($pdo, (int)$row['PID'], $row['PIMG'] ?? null);
$row['gallery_img'] = $hover ?: '';
if (!isset($row['DISCOUNT_TYPE'])) $row['DISCOUNT_TYPE'] = 0;
if (!isset($row['DICOUNT_VALUE'])) $row['DICOUNT_VALUE'] = 0;
}
// Find this section (around line 80-95) and replace it:
// Fetch collections for the shop by collection section
try {
// Build WHERE clause for gender filtering
$collectionWhere = "";
$collectionParams = [];
if ($gender !== 'all') {
$collectionWhere = "WHERE p.category = ?";
$collectionParams[] = $gender;
}
$collectionsQuery = "SELECT DISTINCT c.collection_name, c.collection_image
FROM collections c
INNER JOIN products p ON p.collection_id = c.id
WHERE c.collection_name IS NOT NULL
AND c.collection_image IS NOT NULL
AND p.status IN ('approved', 'published')
" . ($gender !== 'all' ? "AND p.category = ?" : "") . "
ORDER BY c.collection_name
LIMIT 10";
$collectionsStmt = $pdo->prepare($collectionsQuery);
if ($gender !== 'all') {
$collectionsStmt->execute([$gender]);
} else {
$collectionsStmt->execute();
}
$indexCollections = $collectionsStmt->fetchAll(PDO::FETCH_ASSOC);
// Rename keys to match expected format
foreach ($indexCollections as &$coll) {
$coll['name'] = $coll['collection_name'];
$coll['image'] = $coll['collection_image'];
}
unset($coll);
} catch (PDOException $e) {
error_log("Collections fetch error: " . $e->getMessage());
$indexCollections = [];
}
unset($row);
?>
<?php
$imageUrlbanner = '../Images/BrandLogos';
$sql = "SELECT id, logo_image, display_order
FROM brand_logos
WHERE status = 'active'
ORDER BY display_order ASC, id ASC";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$brandLogos = [];
while ($row = $stmt->fetch()) {
$logos = json_decode($row['logo_image'], true);
if (is_array($logos)) {
foreach ($logos as $logo) {
$brandLogos[] = [
'id' => $row['id'],
'logo' => $logo
];
}
}
}
?>
<style>
/* Collection Slider Section */
.idx-collection-section {
background: #fff;
margin-top: 100px;
}
.idx-collection-header {
/*text-align: center;*/
margin-bottom: 50px;
}
.idx-collection-title {
font-size: 28px;
font-weight: 500;
color: #000;
margin-bottom: 10px;
}
.idx-collection-subtitle {
font-size: 16px;
color: #666;
max-width: 600px; /* set readable width */
}
/* Slider Container */
.idx-collection-slider-wrapper {
position: relative;
/*max-width: 1500px;*/
/*margin: 0 auto;*/
/*padding: 0 60px;*/
}
.idx-collection-swiper {
overflow: hidden;
width: 100%;
}
.idx-collection-swiper-wrapper {
display: flex;
transition: transform 0.5s ease;
}
.idx-collection-slide {
flex-shrink: 0;
width: 50%;
/*padding: 0 15px;*/
}
.idx-collection-card {
position: relative;
display: block;
text-decoration: none;
transition: transform 0.4s ease;
}
.idx-collection-card:hover {
transform: translateY(-8px);
}
.idx-collection-img-wrapper {
position: relative;
width: 100%;
height: 620px;
overflow: hidden;
border-radius: 0;
background: #f5f5f5;
}
.idx-collection-img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.5s ease;
}
.idx-collection-card:hover .idx-collection-img {
transform: scale(1.05);
}
/* Bottom Card with Title */
.idx-collection-info-card {
position: absolute;
bottom: 25px;
left: 25px;
background: #fff;
padding: 20px 30px;
border-radius: 0;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
transition: all 0.3s ease;
max-width: calc(100% - 50px);
}
.idx-collection-card:hover .idx-collection-info-card {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}
.idx-collection-name {
color: #000;
font-size: 18px;
font-weight: 600;
margin: 0 0 8px 0;
line-height: 1.2;
}
.idx-collection-arrow {
display: inline-flex;
align-items: center;
color: #000;
font-size: 14px;
font-weight: 500;
gap: 8px;
transition: gap 0.3s ease;
}
.idx-collection-card:hover .idx-collection-arrow {
gap: 12px;
}
.idx-collection-arrow svg {
width: 17px;
height: 17px;
transition: transform 0.3s ease;
}
.idx-collection-card:hover .idx-collection-arrow svg {
transform: translateX(4px);
}
/* Yellow underline accent */
.idx-collection-underline {
width: 60px;
height: 3px;
background: #FFD700;
margin-top: 12px;
transition: width 0.3s ease;
}
.idx-collection-card:hover .idx-collection-underline {
width: 80px;
}
/* Navigation Buttons */
.idx-slider-nav-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 50px;
height: 50px;
background: #fff;
border: none;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
transition: all 0.3s ease;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.idx-slider-nav-btn:hover {
background: #000;
box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.idx-slider-nav-btn:hover svg {
stroke: #fff;
}
.idx-slider-nav-btn:disabled {
opacity: 0.3;
cursor: not-allowed;
background: #f5f5f5;
}
.idx-slider-nav-btn svg {
width: 24px;
height: 24px;
stroke: #000;
}
.idx-slider-prev {
left: 0;
}
.idx-slider-next {
right: 0;
}
/* Pagination */
.idx-slider-pagination {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 40px;
}
.idx-pagination-dot {
width: 10px;
height: 10px;
background: #ddd;
border: none;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s ease;
padding: 0;
}
.idx-pagination-dot.active {
background: #000;
width: 30px;
border-radius: 5px;
}
.idx-pagination-dot:hover {
background: #999;
}
@media (max-width: 480px) {
.idx-collection-title {
font-size: 28px;
}
.idx-collection-slider-wrapper {
padding: 0 50px;
}
.idx-collection-slide {
width: 100%;
}
.idx-collection-img-wrapper {
height: 350px;
}
.idx-collection-info-card {
bottom: 15px;
left: 15px;
padding: 15px 20px;
max-width: calc(100% - 30px);
}
.idx-collection-name {
font-size: 20px;
}
.idx-collection-arrow {
font-size: 16px;
}
.idx-collection-arrow svg {
width: 18px;
height: 18px;
}
.idx-slider-nav-btn {
width: 40px;
height: 40px;
}
.idx-slider-nav-btn svg {
width: 20px;
height: 20px;
}
.idx-collection-slider-wrapper {
padding: 0 0px;
}
.idx-collection-img-wrapper {
height: 300px;
}
.idx-collection-info-card {
bottom: 12px;
left: 12px;
padding: 12px 18px;
}
.idx-collection-name {
font-size: 18px;
}
.idx-slider-nav-btn {
width: 35px;
height: 35px;
}
}
/*#idxCollectionWrapper{*/
/* gap: 15px;*/
/*}*/
</style>
<?php if (!empty($banners)): ?>
<div class="container-fluid mt-4 cf-sm-pl-0">
<div class="main-container">
<!-- Text slider -->
<div class="text-swiper-container">
<div class="swiper-wrapper">
<?php foreach ($banners as $banner): ?>
<div class="swiper-slide swiper-slide-1">
<div class="slide-content">
<div class="slide-tag"><?= htmlspecialchars($banner['des'] ?? '') ?></div>
<h1 class="slide-title"><?= htmlspecialchars($banner['titke'] ?? '') ?></h1>
<a href="../user/shop" class="slide-btn btn-effect">Shop Now</a>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="swiper-navigation">
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
<div class="swiper-button-next"></div>
</div>
</div>
<!-- Static image container -->
<div class="static-image-container">
<div class="image-swiper-container">
<div class="swiper-wrapper">
<?php foreach ($banners as $banner): ?>
<div class="swiper-slide image-slide">
<img src="<?= $bannerUrlBase . '/' . htmlspecialchars($banner['img']) ?>" alt="<?= htmlspecialchars($banner['titke'] ?: 'Banner') ?>">
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="cf-sm-pl-10">
<h1 class="ctaegory_heading_h1 mt-smm-40" style="font-size: 28px;
font-weight: 500;
color: #000; margin-top:150px;">
Find Your Style — Shop by Category
</h1>
</div>
<div class="fashion-grid-container">
<?php if (!empty($categories1)): ?>
<?php foreach ($categories1 as $row): ?>
<?php
// Prefer a slug if you have it; fallback to category name
$cat = $row['category_slug'] ?? $row['category'];
$catParam = urlencode($cat);
?>
<a class="category-card-wrapper"
href="../user/shop.php?category=<?= $catParam ?>"
style="text-decoration:none; color:inherit; display:block;">
<img
src="<?php echo !empty($row['pthumb']) ? '../Images/Product/' . $row['pthumb'] : 'https://via.placeholder.com/500x600?text=No+Image'; ?>"
alt="<?php echo htmlspecialchars($row['category']); ?>"
class="card-background-image"
/>
<div class="card-overlay-content">
<div class="category-tag-label">
<!--<?php echo htmlspecialchars($row['category']); ?>-->
</div>
<div class="card-content-bottom">
<h2 class="card-title-text">
<?php echo htmlspecialchars($row['category']); ?>
</h2>
</div>
</div>
</a>
<?php endforeach; ?>
<?php else: ?>
<div class="col-12 text-center py-5">
<h4>No categories found</h4>
</div>
<?php endif; ?>
</div>
<!-- ============================================
HTML STRUCTURE - Add this in your index.php body where you want the slider
<?php
// Fetch products for "Style Gone Viral" based on gender
$genderWhere2 = "";
if ($gender !== 'all') {
$genderWhere2 = "AND p.category = :gender";
}
$lookProductsSql = "SELECT p.pid AS PID, p.pname AS PNAME, p.pthumb AS PTHUMB, p.pdes AS PDES, p.category AS CATEGORY,
(SELECT pv.variant_title FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS VNAME,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS PRICE,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price DESC LIMIT 1) AS OLD_PRICE
FROM products p WHERE p.status IN ('approved','published') $genderWhere2 ORDER BY RAND() LIMIT 2";
$lookStmt = $pdo->prepare($lookProductsSql);
if ($gender !== 'all') {
$lookStmt->bindValue(':gender', $gender);
}
$lookStmt->execute();
$lookProducts = $lookStmt->fetchAll();
?>
<!-- Style Gone Viral Section -->
<div class="viralStyleMainContainer">
<div class="featuredLabelText">Featured</div>
<h1 class="viralTitleHeading">Style Gone Viral</h1>
<div class="heroImageSection">
<img
src="img/banner-full-width.jpg"
alt="Style Model"
class="modelBackgroundImage"
/>
<div class="shadowOverlayEffect"></div>
<div class="leafShadowPattern"></div>
<div class="lookDetailsOverlay" id="lookOverlay">
<div class="overlayHeaderSection">
<div class="shopLookTitle">Shop the Look</div>
<svg class="closeButtonIcon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</div>
<div class="productListContainer" id="productList">
<?php foreach ($lookProducts as $row): ?>
<?php
$productUrl = "product_details.php?product=" . makeUrl($row['PNAME']) . "&variant=" . makeUrl($row['VNAME']) . "&pid=" . $row['PID'];
?>
<a href="<?php echo $productUrl; ?>" class="individualProductItem" style="text-decoration:none; color:inherit;">
<img
src="<?php echo !empty($row['PTHUMB']) ? '../Images/Product/' . $row['PTHUMB'] : 'https://via.placeholder.com/100x100?text=No+Image'; ?>"
alt="<?php echo htmlspecialchars($row['PNAME']); ?>"
class="productThumbImage"
/>
<div class="productInfoDetails">
<div class="productBrandName"><?php echo htmlspecialchars($row['CATEGORY']); ?></div>
<div class="productItemName"><?php echo htmlspecialchars($row['PNAME']); ?></div>
<div class="productPriceDisplay">
<span class="currentPriceAmount">₹<?php echo number_format((float)$row['PRICE'], 2); ?></span>
<?php if (is_numeric($row['OLD_PRICE']) && $row['OLD_PRICE'] > $row['PRICE']): ?>
<span class="originalPriceAmount">₹<?php echo number_format((float)$row['OLD_PRICE'], 2); ?></span>
<?php endif; ?>
</div>
</div>
<svg class="productArrowIcon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3"></path>
</svg>
</a>
<?php endforeach; ?>
</div>
<button class="shopLookButton btn-slide-effect" id="shopButton">
<span>Shop the Look</span>
<span class="productCountBadge"><?php echo count($lookProducts); ?> Products</span>
</button>
</div>
</div>
</div>
<!-- ========== BRAND MARQUEE SECTION ========== -->
<!-- ========== BRAND MARQUEE SECTION ========== -->
<style>
.voh-marquee-wrapper{
overflow:hidden;
width:100%;
background:#fff;
padding:40px 0;
}
.voh-marquee-track{
display:flex;
width:max-content;
animation:vohSlide 25s linear infinite;
white-space:nowrap;
}
@keyframes vohSlide{
from{transform:translateX(0);}
to{transform:translateX(-50%);}
}
.voh-marquee-logo{
display:inline-flex;
width:150px;
height:90px;
justify-content:center;
align-items:center;
margin:0 20px;
}
.voh-marquee-logo img{
width:70%;
object-fit:contain;
filter:grayscale(100%);
transition:.3s;
}
.voh-marquee-logo:hover img{
filter:none;
}
</style>
<div class="voh-marquee-wrapper">
<div class="voh-marquee-track">
<?php foreach($brandLogos as $brand): ?>
<div class="voh-marquee-logo">
<img src="<?= $imageUrlbanner . '/' . htmlspecialchars($brand['logo']); ?>">
</div>
<?php endforeach; ?>
<?php foreach($brandLogos as $brand): ?>
<div class="voh-marquee-logo">
<img src="<?= $imageUrlbanner . '/' . htmlspecialchars($brand['logo']); ?>">
</div>
<?php endforeach; ?>
</div>
</div>
<style>
/* Gender Filter Buttons */
.gender-filter-container {
display: flex;
gap: 8px;
justify-content: center;
margin-bottom: 20px;
}
.gender-filter-btn {
padding: 8px 20px;
background: white;
border: 1px solid rgb(222, 222, 222);
border-radius: 6px;
font-size: 14px;
font-weight: 500;
color: #333;
cursor: pointer;
transition: all 0.3s ease;
}
.gender-filter-btn:hover {
border: 1px solid rgb(222, 222, 222);
background: #f5f5f5;
}
.gender-filter-btn.active {
background: #f2f2f2;
color: black;
border-color: #dedede;
}
/* ========================================
COMMON OFFER BADGE & TIMER STYLES
Used across all 4 sections
======================================== */
/* Common Offer Badge */
.offer-badge-common {
position: absolute;
top: 10px;
right: 10px;
background: black;
color: white;
padding: 6px 12px;
border-radius: 4px;
font-size: 11px;
font-weight: 500;
letter-spacing: 0.5px;
text-transform: uppercase;
z-index: 3;
}
.obc-final {
position: absolute;
top: 10px;
right: 10px;
background: black;
color: white;
padding: 4px 7px;
border-radius: 4px;
}
/* Common Offer Price */
.offer-price-common {
color: #667eea !important;
font-weight: 700 !important;
}
/* Common Offer Price Section - SAME ROW LAYOUT */
.offer-price-section-common {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
transition: opacity 0.3s ease;
width: 100%;
}
.offer-price-row-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
transition: opacity 0.3s ease;
flex-wrap: nowrap;
}
.offer-price-row {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
/* Common Offer Timer */
.offer-timer-common {
display: flex;
align-items: center;
gap: 4px;
font-size: 11px;
color: #dc3545;
font-weight: 500;
white-space: nowrap;
flex-shrink: 0;
position: relative;
bottom: 6px;
margin-left: 10px;
}
.offer-timer-common i {
font-size: 11px;
}
.offer-timer-common .timer-text {
font-weight: 600;
}
.offer-timer-common.expiring-soon {
animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.6; }
}
/* Hide price info on hover for sections that support it */
.nw-hoverable:hover .nw-price-info {
opacity: 0;
}
.nw-hoverable:hover .offer-price-row-wrapper {
opacity: 0;
pointer-events: none;
}
/* Section-specific adjustments for slider */
.product-slide-item .offer-badge-common {
top: 15px;
right: 15px;
}
.product-slide-item .obc-final {
top: 0px;
right: 0px;
}
.product-slide-item .offer-timer-common {
font-size: 10px;
}
/* Ensure hover actions appear above price */
.nw-hover-actions,
.product-actions {
position: absolute;
bottom: 20px;
left: 0;
display: flex;
gap: 15px;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 10;
}
.nw-hoverable:hover .nw-hover-actions,
.product-card:hover .product-actions {
opacity: 1;
}
/* More to Love section - hide prices on hover */
.product-card:hover .product-price {
opacity: 0;
pointer-events: none;
}
.product-card:hover .offer-price-row-wrapper {
opacity: 0;
pointer-events: none;
}
</style>
<?php
function collectTwoImages(PDO $pdo, array $p): array {
$images = [];
// 1) pimg (JSON or CSV)
if (!empty($p['PIMG'])) {
$decoded = json_decode($p['PIMG'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
foreach ($decoded as $img) if (!empty($img)) $images[] = trim($img);
} else {
foreach (array_filter(array_map('trim', explode(',', $p['PIMG']))) as $img) {
if (!empty($img)) $images[] = $img;
}
}
}
// 2) fallback to variations (image_path, variant_data.image, variant_data.gallery)
if (count($images) < 2) {
$st = $pdo->prepare("SELECT image_path, variant_data FROM product_variations WHERE PID = ? ORDER BY price ASC");
$st->execute([$p['PID']]);
$vars = $st->fetchAll();
foreach ($vars as $v) {
if (!empty($v['image_path'])) $images[] = trim($v['image_path']);
if (!empty($v['variant_data'])) {
$vd = json_decode($v['variant_data'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($vd)) {
if (!empty($vd['image'])) $images[] = trim($vd['image']);
if (!empty($vd['gallery']) && is_array($vd['gallery'])) {
foreach ($vd['gallery'] as $g) if (!empty($g)) $images[] = trim($g);
}
}
}
if (count($images) >= 2) break;
}
}
// 3) last resort: pthumb
if (empty($images) && !empty($p['PTHUMB'])) $images[] = $p['PTHUMB'];
if (count($images) === 1) $images[] = $images[0]; // duplicate if only one
$images = array_values(array_unique(array_filter($images)));
if (empty($images)) $images = ['default.jpg', 'default.jpg'];
return array_slice($images, 0, 2);
}
function collectProductImages(PDO $pdo, array $p): array {
$images = [];
// 1) pimg (JSON or CSV)
if (!empty($p['PIMG'])) {
$decoded = json_decode($p['PIMG'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
foreach ($decoded as $img) if (!empty($img)) $images[] = trim($img);
} else {
foreach (array_filter(array_map('trim', explode(',', $p['PIMG']))) as $img) {
if (!empty($img)) $images[] = $img;
}
}
}
// 2) fallback to variations
if (empty($images)) {
$st = $pdo->prepare("SELECT image_path, variant_data FROM product_variations WHERE PID = ? ORDER BY price ASC");
$st->execute([$p['PID']]);
$vars = $st->fetchAll();
foreach ($vars as $v) {
if (!empty($v['image_path'])) $images[] = trim($v['image_path']);
if (!empty($v['variant_data'])) {
$vd = json_decode($v['variant_data'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($vd)) {
if (!empty($vd['image'])) $images[] = trim($vd['image']);
if (!empty($vd['gallery']) && is_array($vd['gallery'])) {
foreach ($vd['gallery'] as $g) if (!empty($g)) $images[] = trim($g);
}
}
}
}
}
// 3) last resort: pthumb
if (empty($images) && !empty($p['PTHUMB'])) $images[] = $p['PTHUMB'];
$images = array_values(array_unique(array_filter($images)));
if (empty($images)) $images = ['default.jpg'];
return $images;
}
?>
<?php
// ========== Customer Choice Section with Make an Offer ==========
$sql = "
SELECT
p.pid AS PID,
p.pname AS PNAME,
p.pthumb AS PTHUMB,
p.pimg AS PIMG,
p.pdes AS PDES,
p.category AS CNAME,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS NEW_PRICE,
(SELECT pv.variant_title FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS VNAME,
o.offer_id AS OFFER_ID,
o.offer_amount AS OFFER_PRICE,
o.offer_valid_until AS OFFER_VALID_UNTIL
FROM products p
INNER JOIN today_products tp ON p.pid = tp.pid
LEFT JOIN tbl_offers o ON o.product_id = p.pid AND o.status = 'accepted' AND o.offer_valid_until > NOW()
" . (isset($_SESSION['user_id']) ? "AND o.user_id = " . (int)$_SESSION['user_id'] : "AND 1=0") . "
WHERE p.status IN ('approved','published')
ORDER BY tp.id ASC
";
$todayProductsResult = $pdo->query($sql)->fetchAll();
$todayProductsCount = count($todayProductsResult);
if ($todayProductsCount === 0) {
echo '<div class="kimono-product-container" style="margin-top:50px"><header class="customer-favorites-header"><h1 class="favorites-title-main">Customers Choice</h1><p class="favorites-subtitle-desc">No products available.</p></header></div>';
} elseif ($todayProductsCount === 1) {
// Single product
$p = $todayProductsResult[0];
$imageUrl = '../Images/Product';
[$imgA, $imgB] = collectTwoImages($pdo, $p);
$imgA = $imageUrl . '/' . $imgA;
$imgB = $imageUrl . '/' . $imgB;
$detailsUrl = "product_details.php?product=" . makeUrl($p['PNAME']) . "&variant=" . makeUrl($p['VNAME']) . "&pid=" . (int)$p['PID'];
$hasOffer = !empty($p['OFFER_ID']) && !empty($p['OFFER_VALID_UNTIL']);
$offerPrice = $hasOffer ? $p['OFFER_PRICE'] : null;
$offerValidUntil = $hasOffer ? $p['OFFER_VALID_UNTIL'] : null;
$displayPrice = $hasOffer ? $offerPrice : $p['NEW_PRICE'];
?>
<style>
.kimono-product-container {
max-width: 1850px;
margin: 0 auto;
}
.customer-favorites-header {
margin-bottom: 50px;
}
.favorites-title-main {
font-size: 28px;
font-weight: 500;
color: #333;
margin-bottom: 8px;
}
.favorites-subtitle-desc {
font-size: 16px;
color: #666;
font-weight: 400;
line-height: 1.4;
}
.product-showcase-layout {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 60px;
align-items: start;
}
.kimono-image-gallery {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
position: sticky;
top: 40px;
height: fit-content;
}
.product-image-frame {
width: 100%;
aspect-ratio: 3/4;
background-color: #f8f8f8;
border-radius: 8px;
overflow: hidden;
position: relative;
}
.product-image-frame img {
width: 100%;
height: 100%;
object-fit: cover;
}
.product-details-panel {
padding: 40px 95px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
min-height: 100vh;
position: sticky;
top: 0;
}
.brand-collection-tag {
font-size: 14px;
color: black;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
}
.cc-title {
font-size: 22px;
font-weight: 600;
color: black;
margin-bottom: 20px;
line-height: 1.2;
}
.product-price-display {
font-size: 25px;
font-weight: 600;
color: black;
margin-bottom: 12px;
}
.tax-shipping-info {
font-size: 13px;
color: #888;
margin-bottom: 32px;
line-height: 1.4;
}
.cc-action-buttons {
display: flex;
gap: 10px;
width: 100%;
margin-top: 20px;
}
.cc-view-btn, .cc-offer-btn {
flex: 1;
display: inline-block;
padding: 14px 40px;
border-radius: 4px;
text-decoration: none;
font-weight: 500;
transition: all 0.3s ease;
text-align: center;
border: none;
cursor: pointer;
font-size: 14px;
}
.cc-view-btn {
background: #000;
color: #fff;
}
.cc-view-btn:hover {
background: #333;
color: #fff;
transform: translateY(-2px);
}
.cc-offer-btn {
background: #fff;
color: #000;
border: 1px solid #6c757d;
}
.cc-offer-btn:hover {
background: #6c757d;
color: #fff;
}
.cc-offer-btn.offer-active-btn {
background-color: #28a745;
border-color: #28a745;
color: white;
cursor: not-allowed;
opacity: 0.8;
}
/* Apply only on laptop screens */
@media (min-width: 1200px) and (max-width: 1599px) {
.product-details-panel {
padding: 40px 36px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
min-height: 100vh;
position: sticky;
top: 0;
}
}
@media (max-width: 768px) {
.cc-action-buttons {
flex-direction: column;
}
.product-showcase-layout {
grid-template-columns: 1fr;
}
.product-details-panel {
padding: 20px;
min-height: auto;
}
}
/* ============================================
MOBILE RESPONSIVE CHANGES
Add these media queries to your existing CSS
============================================ */
/* Single Product Layout (1 product) */
@media (max-width: 768px) {
.kimono-product-container {
padding: 40px 15px;
}
.product-showcase-layout {
grid-template-columns: 1fr;
gap: 30px;
}
/* Remove sticky effect on mobile */
.kimono-image-gallery {
position: relative;
top: auto;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
/* Apply 200px height only on mobile */
.product-image-frame {
width: 100%;
height: 200px !important;
aspect-ratio: auto;
min-height: 200px;
max-height: 200px;
}
.product-image-frame img {
width: 100%;
height: 200px;
object-fit: cover;
}
/* Remove sticky effect and adjust padding */
.product-details-panel {
position: relative;
top: auto;
padding: 30px 20px;
min-height: auto;
}
.favorites-title-main {
font-size: 24px;
}
.favorites-subtitle-desc {
font-size: 14px;
}
.cc-title {
font-size: 20px;
}
.product-price-display {
font-size: 22px;
}
.cc-action-buttons {
flex-direction: column;
gap: 12px;
}
.cc-view-btn, .cc-offer-btn {
width: 100%;
padding: 12px 20px;
}
}
/* Split Screen Layout (2-4 products) */
@media (max-width: 768px) {
.cc-split-container {
flex-direction: column;
min-height: auto;
margin-top: 30px;
}
.cc-images-section {
padding: 15px;
gap: 10px;
grid-template-columns: repeat(2, 1fr);
}
.cc-image-card {
aspect-ratio: 3/4;
}
.cc-details-section {
padding: 30px 20px;
}
.cc-title {
font-size: 22px;
margin-bottom: 15px;
}
.cc-price {
font-size: 20px;
}
.cc-category {
font-size: 12px;
}
.cc-tax-info {
font-size: 13px;
margin-bottom: 25px;
}
.cc-action-buttons-split {
flex-direction: column;
gap: 12px;
}
.cc-view-btn-split, .cc-offer-btn-split {
width: 100%;
padding: 12px 20px;
}
}
/* Slider Layout (5+ products) */
@media (max-width: 768px) {
.fashion-carousel-container {
margin-top: 50px;
padding: 0 15px;
}
.fashion-carousel-header {
flex-direction: column;
align-items: flex-start;
gap: 20px;
}
.fashion-carousel-title {
font-size: 24px;
}
.fashion-carousel-nav {
width: 100%;
justify-content: space-between;
}
.fashion-carousel-wrapper {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.fashion-carousel-track {
gap: 15px;
}
.fashion-product-card {
min-width: 250px;
max-width: 250px;
}
.fashion-product-image {
height: 320px;
}
.fashion-product-brand {
font-size: 11px;
}
.fashion-product-name {
font-size: 14px;
}
.fashion-product-price {
font-size: 16px;
}
.fashion-product-actions {
font-size: 12px;
}
/* Hide navigation arrows on very small screens */
.fashion-nav-arrow {
display: none;
}
}
/* Extra small devices */
@media (max-width: 480px) {
.cc-images-section {
grid-template-columns: 1fr;
}
.cc-details-section {
padding: 25px 15px;
}
.product-details-panel {
padding: 25px 15px;
}
.fashion-product-card {
min-width: 200px;
max-width: 200px;
}
.fashion-product-image {
height: 270px;
}
}
/* Offer timer responsive adjustments */
@media (max-width: 768px) {
.offer-timer-common {
font-size: 11px;
padding: 4px 8px;
}
.offer-badge-common {
font-size: 10px;
padding: 4px 10px;
}
.offer-price-row-wrapper {
flex-direction: column;
align-items: center;
gap: 8px;
}
}
</style>
<div class="kimono-product-container cf-sm-pl-10 mt-smm-00" style="margin-top:50px">
<header class="customer-favorites-header">
<h1 class="favorites-title-main">Customers Choice</h1>
<p class="favorites-subtitle-desc">
Discover favorites handpicked by our customers, for standout style choices.
</p>
</header>
<div class="product-showcase-layout">
<div class="kimono-image-gallery">
<div class="product-image-frame">
<img src="<?php echo htmlspecialchars($imgA); ?>" alt="<?php echo htmlspecialchars($p['PNAME']); ?>">
<?php if ($hasOffer): ?>
<div class="offer-badge-common">Offer Product</div>
<?php endif; ?>
</div>
<div class="product-image-frame">
<img src="<?php echo htmlspecialchars($imgB); ?>" alt="<?php echo htmlspecialchars($p['PNAME']); ?>">
</div>
</div>
<div class="product-details-panel">
<div class="brand-collection-tag"><?php echo htmlspecialchars($p['CNAME'] ?: ''); ?></div>
<h2 class="cc-title"><?php echo htmlspecialchars($p['PNAME']); ?></h2>
<?php if ($hasOffer): ?>
<div class="offer-price-row-wrapper" style="justify-content: center;">
<div class="product-price-display offer-price-common">₹<?php echo number_format((float)$displayPrice, 2); ?></div>
<div class="offer-timer-common" data-offer-end="<?php echo $offerValidUntil; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="product-price-display">₹<?php echo number_format((float)$displayPrice, 2); ?></div>
<?php endif; ?>
<div class="tax-shipping-info">
Tax included. Shipping calculated at checkout.
</div>
<div class="cc-action-buttons">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" class="cc-view-btn">View Full Details</a>
<?php if ($hasOffer): ?>
<button class="cc-offer-btn offer-active-btn" disabled>
<i class="fa fa-check-circle"></i> Offer Active
</button>
<?php else: ?>
<button class="cc-offer-btn cc-make-offer-btn"
data-product-id="<?php echo $p['PID']; ?>"
data-product-name="<?php echo htmlspecialchars($p['PNAME']); ?>"
data-variant-name="<?php echo htmlspecialchars($p['VNAME']); ?>"
data-product-price="<?php echo $displayPrice; ?>">
<i class="fa fa-tags"></i> Make an Offer
</button>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php
} elseif ($todayProductsCount >= 2 && $todayProductsCount <= 4) {
// 2-4 Products Split Screen
$imageUrl = '../Images/Product';
$limitedProducts = array_slice($todayProductsResult, 0, 4);
$productsData = [];
foreach ($limitedProducts as $prod) {
$allImages = collectProductImages($pdo, $prod);
$productsData[] = [
'pid' => $prod['PID'],
'pname' => $prod['PNAME'],
'category' => $prod['CNAME'] ?: 'Product',
'vname' => $prod['VNAME'] ?? '',
'images' => $allImages,
'price' => $prod['OFFER_PRICE'] ?: $prod['NEW_PRICE'],
'has_offer' => !empty($prod['OFFER_ID']),
'offer_end' => $prod['OFFER_VALID_UNTIL'] ?? ''
];
}
?>
<style>
.cc-split-container {
display: flex;
min-height: auto; /* ✅ FIXED - allows natural height */
background: #fff;
margin-top: 50px;
}
.cc-images-section {
flex: 1;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
}
.cc-image-card {
position: relative;
cursor: pointer;
overflow: hidden;
border-radius: 8px;
transition: all 0.3s ease;
aspect-ratio: 4/4;
border: 1px solid transparent;
}
.cc-image-card:hover {
transform: scale(1.02);
box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.cc-image-card.active {
border-color: #000;
}
.cc-product-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.cc-details-section {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 60px 80px;
}
.cc-category {
font-size: 14px;
color: #666;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
}
.cc-title {
font-size: 32px;
font-weight: 600;
color: #000;
margin-bottom: 20px;
line-height: 1.2;
}
.cc-price-section {
margin-bottom: 30px;
}
.cc-price {
font-size: 28px;
font-weight: 600;
color: #000;
margin-right: 15px;
}
.cc-tax-info {
font-size: 14px;
color: #666;
margin-bottom: 40px;
}
.cc-action-buttons-split {
display: flex;
gap: 8px;
width: 100%;
margin-top: 20px;
}
.cc-view-btn-split, .cc-offer-btn-split {
flex: 1;
display: inline-block;
padding: 12px 24px;
border-radius: 4px;
text-decoration: none;
font-weight: 500;
transition: all 0.3s ease;
text-align: center;
border: none;
cursor: pointer;
font-size: 13px;
}
.cc-view-btn-split {
background: #000;
color: #fff;
}
.cc-view-btn-split:hover {
background: #333;
color: #fff;
}
.cc-offer-btn-split {
background: #fff;
color: #000;
border: 1px solid #6c757d;
}
.cc-offer-btn-split:hover {
background: #6c757d;
color: #fff;
}
.cc-offer-btn-split.offer-active-btn {
background-color: #28a745;
border-color: #28a745;
color: white;
cursor: not-allowed;
}
@media (max-width: 768px) {
.cc-split-container {
flex-direction: column;
min-height: auto; /* ✅ Also fix for mobile */
}
.cc-images-section {
padding: 20px;
gap: 10px;
}
.cc-details-section {
padding: 40px 20px;
}
.cc-title {
font-size: 24px;
}
.cc-price {
font-size: 22px;
}
}
</style>
<header class="customer-favorites-header">
<h1 class="favorites-title-main">Customers Choice</h1>
<p class="favorites-subtitle-desc">
Discover favorites handpicked by our customers, for standout style choices.
</p>
</header>
<div class="cc-split-container">
<div class="cc-images-section">
<?php foreach ($productsData as $index => $prod):
$imgSrc = !empty($prod['images'][0]) ? $imageUrl . '/' . $prod['images'][0] : 'https://via.placeholder.com/400x500';
$isActive = $index === 0 ? 'active' : '';
?>
<div class="cc-image-card <?php echo $isActive; ?>"
data-index="<?php echo $index; ?>"
data-product='<?php echo htmlspecialchars(json_encode($prod)); ?>'>
<img src="<?php echo htmlspecialchars($imgSrc); ?>"
alt="<?php echo htmlspecialchars($prod['pname']); ?>"
class="cc-product-img">
<?php if ($prod['has_offer']): ?>
<div class="offer-badge-common">Offer Product</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="cc-details-section">
<div id="ccDetailsContent">
<?php
$firstProd = $productsData[0];
?>
<div class="cc-category"><?php echo htmlspecialchars($firstProd['category']); ?></div>
<h2 class="cc-title"><?php echo htmlspecialchars($firstProd['pname']); ?></h2>
<div class="cc-price-section">
<?php if ($firstProd['has_offer']): ?>
<div class="offer-price-row-wrapper" style="justify-content: center;">
<div class="cc-price offer-price-common">₹<?php echo number_format((float)$firstProd['price'], 2); ?></div>
<div class="offer-timer-common" data-offer-end="<?php echo $firstProd['offer_end']; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="cc-price">₹<?php echo number_format((float)$firstProd['price'], 2); ?></div>
<?php endif; ?>
</div>
<div class="cc-tax-info">Tax included. Shipping calculated at checkout.</div>
<div class="cc-action-buttons-split">
<a href="product_details.php?product=<?php echo makeUrl($firstProd['pname']); ?>&variant=<?php echo makeUrl($firstProd['vname']); ?>&pid=<?php echo $firstProd['pid']; ?>"
class="cc-view-btn-split">View Details</a>
<?php if ($firstProd['has_offer']): ?>
<button class="cc-offer-btn-split offer-active-btn" disabled>
<i class="fa fa-check-circle"></i> Offer Active
</button>
<?php else: ?>
<button class="cc-offer-btn-split cc-make-offer-btn"
data-product-id="<?php echo $firstProd['pid']; ?>"
data-product-name="<?php echo htmlspecialchars($firstProd['pname']); ?>"
data-variant-name="<?php echo htmlspecialchars($firstProd['vname']); ?>"
data-product-price="<?php echo $firstProd['price']; ?>">
<i class="fa fa-tags"></i> Make Offer
</button>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php
} else {
// 5+ Products - Slider
$imageUrl = '../Images/Product';
?>
<div class="fashion-carousel-container" style="margin-top:100px">
<div class="fashion-carousel-header">
<h2 class="fashion-carousel-title">Customers Choice</h2>
<div class="fashion-carousel-nav">
<button class="fashion-nav-arrow" id="fashionPrevBtn">
<svg class="icon icon-caret-left" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.3189 8.14033L18 8.14033V9.86559L3.3189 9.86559L10.2284 16.7751L9 18L0 9L9 0L10.2284 1.22488L3.3189 8.14033Z" fill="currentColor"></path>
</svg>
</button>
<button class="fashion-nav-arrow" id="fashionNextBtn">
<svg class="icon icon-caret-right" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.6811 9.85967H0L0 8.13441H14.6811L7.77157 1.22488L9 0L18 9L9 18L7.77157 16.7751L14.6811 9.85967Z" fill="currentColor"></path>
</svg>
</button>
<a href="../user/shop" class="fashion-view-all btn-effect-light">View All</a>
</div>
</div>
<div class="fashion-carousel-wrapper">
<div class="fashion-carousel-track" id="fashionTrack">
<?php foreach ($todayProductsResult as $row):
$mainImage = ($row['PTHUMB'] === '' ? (firstFromPimg($row['PIMG'] ?? null) ?: 'default.jpg') : $row['PTHUMB']);
$hoverImage = getFirstGalleryImage($pdo, (int)$row['PID'], $row['PIMG'] ?? null) ?: '';
$detailsUrl = 'product_details.php?product=' . makeUrl($row['PNAME']) .
'&variant=' . makeUrl($row['VNAME']) .
'&pid=' . (int)$row['PID'];
$hasOffer = !empty($row['OFFER_ID']) && !empty($row['OFFER_VALID_UNTIL']);
$offerPrice = $hasOffer ? $row['OFFER_PRICE'] : null;
$offerValidUntil = $hasOffer ? $row['OFFER_VALID_UNTIL'] : null;
$displayPrice = $hasOffer ? $offerPrice : $row['NEW_PRICE'];
?>
<div class="fashion-product-card"
onclick="window.location.href='<?php echo htmlspecialchars($detailsUrl); ?>';"
style="cursor:pointer">
<div style="position: relative">
<?php if ($hasOffer): ?>
<div class="offer-badge-common">Offer Product</div>
<?php endif; ?>
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" onclick="event.stopPropagation();" class="d-block">
<img
src="<?php echo $imageUrl . '/' . htmlspecialchars($mainImage); ?>"
alt="<?php echo htmlspecialchars($row['PNAME']); ?>"
class="fashion-product-image"
/>
<?php if ($hoverImage !== ''): ?>
<img
src="<?php echo $imageUrl . '/' . htmlspecialchars($hoverImage); ?>"
alt="<?php echo htmlspecialchars($row['PNAME']); ?>"
class="fashion-product-image hover-image"
/>
<?php endif; ?>
</a>
</div>
<div class="fashion-product-info">
<div class="fashion-product-brand"><?php echo htmlspecialchars($row['CNAME'] ?: 'Swipe Modern'); ?></div>
<div class="fashion-product-name"><?php echo htmlspecialchars($row['PNAME']); ?></div>
<div class="fashion-product-price-container">
<?php if ($hasOffer): ?>
<div class="offer-price-row-wrapper">
<div class="fashion-product-price offer-price-common">₹ <?php echo number_format((float)$displayPrice, 2); ?></div>
<div class="offer-timer-common" data-offer-end="<?php echo $offerValidUntil; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="fashion-product-price">₹ <?php echo number_format((float)$displayPrice, 2); ?></div>
<?php endif; ?>
<div class="fashion-product-actions">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>"
class="fashion-action-link"
onclick="event.stopPropagation();">Shop Now</a>
<span class="fashion-action-separator">|</span>
<button class="fashion-action-link"
onclick="event.stopPropagation(); openQuickView(<?php echo $row['PID']; ?>)">
Quick View
</button>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="fashion-pagination-border">
<div class="fashion-pagination-progress" id="fashionProgress"></div>
</div>
</div>
<?php
}
?>
<!-- ========== /BRAND MARQUEE SECTION ========== -->
<!-- ========== /BRAND MARQUEE SECTION ========== -->
<style>
.nw-product-card.nw-static .nw-product-image-container {
position: relative;
z-index: 1;
}
.nw-product-card.nw-static .nw-product-image-container::after {
content: "";
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.25);
border-radius: 5px;
z-index: 2;
transition: background 0.3s ease;
}
.nw-product-card.nw-static .nw-badge,
.nw-product-card.nw-static .nw-badge.nw-category {
color: white !important;
position: absolute;
z-index: 3;
}
.nw-section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
.nw-section-title {
font-size: 28px;
font-weight: 500;
color: #000;
}
.nw-view-all {
color: #666;
text-decoration: none;
font-size: 16px;
transition: color 0.3s ease;
}
.nw-view-all:hover {
color: #000;
}
/* FIXED: Changed grid to use exact 4 columns */
.nw-products-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 15px;
align-items: stretch;
}
.nw-product-card {
background: white;
border-radius: 12px;
position: relative;
transition: transform 0.3s ease;
display: flex;
flex-direction: column;
height: 600px;
}
.nw-product-card.nw-hoverable {
height: 657px;
}
.nw-product-card.nw-static {
height: 600px;
}
.nw-product-card:hover {
transform: translateY(-5px);
}
.nw-product-image-container {
position: relative;
background: #f5f5f5;
flex: 1;
border-radius: 5px;
overflow: hidden;
}
.nw-product-card.nw-hoverable .nw-product-image-container {
height: 666px;
}
.nw-product-card.nw-static .nw-product-image-container {
height: 640px;
min-height: 640px;
}
.nw-product-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: opacity 0.3s ease;
border-radius: 5px;
}
.nw-product-image.nw-hover-image {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.nw-product-card.nw-hoverable:hover .nw-product-image.nw-hover-image {
opacity: 1;
}
.nw-product-card.nw-hoverable:hover .nw-product-image.nw-main-image {
opacity: 0;
}
.nw-badge {
position: absolute;
top: 15px;
left: 15px;
color: white;
padding: 8px 12px;
border-radius: 20px;
font-size: 18px;
font-weight: 500;
}
.nw-badge.nw-sale {
background: rgba(220, 53, 69, 0.9);
color: white;
}
.nw-badge.nw-category {
color: white;
bottom: 15px;
top: auto;
font-size: 25px;
font-weight: 500;
}
.nw-add-to-cart-overlay {
position: absolute;
bottom: 20px;
left: 20px;
right: 20px;
opacity: 0;
transform: translateY(20px);
transition: all 0.3s ease;
}
.nw-product-card.nw-hoverable:hover .nw-add-to-cart-overlay {
opacity: 1;
transform: translateY(0);
}
.nw-add-to-cart-btn {
width: 100%;
background: #000;
color: white;
border: none;
padding: 14px 20px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background 0.3s ease;
}
.nw-add-to-cart-btn:hover {
background: #333;
}
.nw-product-info {
padding: 20px 0;
height: 130px;
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 8px;
}
.nw-product-brand {
font-size: 13px;
color: black;
margin-bottom: 0;
line-height: 1.3;
}
.nw-product-name {
color: #666;
font-size: 12px;
font-weight: 500;
margin-bottom: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 1.3;
}
.nw-price-container {
position: relative;
height: 48px;
overflow: visible;
margin-top: auto;
}
.nw-price-info {
display: flex;
align-items: center;
gap: 8px;
transition: transform 0.3s ease, opacity 0.3s ease;
/* FIXED: Prevent text overflow */
flex-wrap: nowrap;
}
.nw-product-card.nw-hoverable:hover .nw-price-info {
transform: translateY(-30px);
opacity: 0;
}
.nw-price {
color: #333;
font-size: 14px;
white-space: nowrap;
}
.nw-price-old {
color: #999;
font-size: 14px;
text-decoration: line-through;
white-space: nowrap;
}
.nw-hover-actions {
display: flex;
gap: 0;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
transform: translateY(30px);
opacity: 0;
transition: all 0.3s ease;
/* FIXED: Prevent text overflow on hover */
white-space: nowrap;
overflow: hidden;
}
.nw-product-card.nw-hoverable:hover .nw-hover-actions {
transform: translateY(0);
opacity: 1;
}
.nw-action-btn {
background: none;
border: none;
color: #333;
font-size: 13px;
cursor: pointer;
padding: 0;
text-decoration: none;
transition: color 0.3s ease;
white-space: nowrap;
}
.nw-action-btn:hover {
color: #666;
}
.nw-action-separator {
color: #666;
margin: 0 8px;
font-weight: normal;
}
.nw-product-card.nw-static .nw-add-to-cart-overlay,
.nw-product-card.nw-static .nw-hover-actions {
display: none;
}
.nw-product-card.nw-static .nw-price-info {
transform: none !important;
opacity: 1 !important;
}
/* Mobile Layout Styles */
.nw-mobile-view-all {
display: none;
}
@media (max-width: 768px) {
.nw-section-title {
font-size: 24px;
}
.nw-section-header {
margin-bottom: 10px;
}
.nw-product-info {
padding-bottom: 20px;
padding-top: 15px;
}
.nw-products-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
.nw-product-card {
height: auto;
}
.nw-product-card.nw-hoverable {
height: auto;
}
.nw-product-card.nw-static {
height: auto;
}
.nw-product-image-container {
height: auto;
}
.nw-product-card.nw-hoverable .nw-product-image-container {
height: auto;
}
.nw-product-card.nw-static .nw-product-image-container {
height: auto;
min-height: auto;
}
.nw-mobile-view-all {
grid-column: 1 / -1;
width: 100%;
text-align: center;
padding: 12px;
background: #f2f2f2;
color: black;
text-decoration: none;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
transition: background 0.3s ease;
display: block;
}
.nw-mobile-view-all:hover {
background: #333;
color: white;
}
.nw-section-header .nw-view-all {
display: none;
}
.mt-smm-00 {
margin-top: 0px !important;
}
}
/* ADDED: Responsive adjustments for smaller screens but above mobile */
@media (max-width: 1200px) and (min-width: 769px) {
.nw-products-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 992px) and (min-width: 769px) {
.nw-products-grid {
grid-template-columns: repeat(2, 1fr);
}
}
</style>
<!-- SECTION 1: New & Noteworthy -->
<div class="cf-sm-pl-10 mt-smm-00" style="margin-top:150px">
<div class="nw-section-header">
<h2 class="nw-section-title">New & Noteworthy</h2>
<a href="../user/shop" class="nw-view-all fashion-view-all btn-effect-light">View All</a>
</div>
<div class="nw-products-grid">
<div class="nw-product-card nw-static" onclick="window.location.href='#';" style="cursor: pointer;">
<div class="nw-product-image-container">
<img src="img/Rectangle_8_4.jpg" alt="Outerwear" class="nw-product-image nw-main-image">
<div class="nw-badge">New</div>
<div class="nw-badge nw-category">Outwear</div>
</div>
</div>
<?php foreach ($products as $row):
$mainImage = ($row['THUMBNAIL'] === '' ? ($row['SINGLE_THUMB'] ?: 'default.jpg') : $row['THUMBNAIL']);
$hoverImage = trim((string)($row['gallery_img'] ?? ''));
$detailsUrl = 'product_details.php?product=' . makeUrl($row['PNAME']) . '&variant=' . makeUrl($row['VNAME']) . '&pid=' . (int)$row['PID'];
$hasOffer = !empty($row['OFFER_ID']) && !empty($row['OFFER_VALID_UNTIL']);
$offerPrice = $hasOffer ? $row['OFFER_PRICE'] : null;
$offerValidUntil = $hasOffer ? $row['OFFER_VALID_UNTIL'] : null;
$displayPrice = $hasOffer ? $offerPrice : $row['NEW_PRICE'];
?>
<div class="nw-product-card nw-hoverable" onclick="window.location.href='<?php echo htmlspecialchars($detailsUrl); ?>';" style="cursor:pointer">
<div class="nw-product-image-container">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" onclick="event.stopPropagation();" class="d-block">
<img src="<?php echo $imageUrl . '/' . htmlspecialchars($mainImage); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="nw-product-image nw-main-image">
<?php if ($hoverImage !== ''): ?>
<img src="<?php echo $imageUrl . '/' . htmlspecialchars($hoverImage); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="nw-product-image nw-hover-image">
<?php endif; ?>
</a>
<?php if ($hasOffer): ?>
<div class="offer-badge-common">Offer Product</div>
<?php elseif ((int)$row['DISCOUNT_TYPE'] === 2 && (float)$row['DICOUNT_VALUE'] > 0): ?>
<div class="nw-badge nw-sale">Get <?php echo (int)$row['DICOUNT_VALUE']; ?>% Off</div>
<?php elseif ((int)$row['DISCOUNT_TYPE'] === 3 && (float)$row['DICOUNT_VALUE'] > 0): ?>
<div class="nw-badge nw-sale">Get ₹<?php echo number_format((float)$row['DICOUNT_VALUE'], 0); ?> Off</div>
<?php endif; ?>
</div>
<div class="nw-product-info">
<div class="nw-product-brand">Swipe Modern</div>
<div class="nw-product-name"><?php echo htmlspecialchars($row['PNAME']); ?></div>
<div class="nw-price-container">
<?php if ($hasOffer): ?>
<div class="offer-price-row-wrapper">
<div class="offer-price-row">
<span class="nw-price offer-price-common">₹ <?php echo number_format((float)$displayPrice, 2); ?></span>
<span class="nw-price-old">₹ <?php echo number_format((float)$row['OLD_PRICE'], 2); ?></span>
</div>
<div class="offer-timer-common" data-offer-end="<?php echo $offerValidUntil; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="nw-price-info">
<span class="nw-price">₹ <?php echo number_format((float)$displayPrice, 2); ?></span>
<?php if ((float)$row['OLD_PRICE'] > (float)$displayPrice): ?>
<span class="nw-price-old">₹ <?php echo number_format((float)$row['OLD_PRICE'], 2); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="nw-hover-actions">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" class="nw-action-btn" onclick="event.stopPropagation();">Shop Now</a>
<span class="nw-action-separator">|</span>
<button class="nw-action-btn nw-quick-view-btn"
onclick="event.stopPropagation(); openQuickView(<?php echo $row['PID']; ?>)"
data-bs-toggle="modal"
data-bs-target="#productModal"
data-id='<?php echo $row['PID']; ?>'
data-image='<?php echo $mainImage; ?>'
data-pname='<?php echo htmlspecialchars($row['PNAME']); ?>'
data-vname='<?php echo htmlspecialchars($row['VNAME']); ?>'
data-des='<?php echo htmlspecialchars($row['PDES']); ?>'
data-price='₹<?php echo number_format($displayPrice, 2); ?>'
data-old-price='₹<?php echo number_format($row['OLD_PRICE'], 2); ?>'
data-cname='<?php echo htmlspecialchars($row['CNAME']); ?>'
data-product-url='<?php echo $detailsUrl; ?>'>
Quick View
</button>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<a href="../user/shop" class="nw-mobile-view-all">View All</a>
</div>
</div>
<section class="idx-collection-section mt-smm-40">
<div class=" cf-sm-pl-10">
<!-- Section Header -->
<div class="idx-collection-header">
<h2 class="idx-collection-title">Shop by Collection</h2>
<p class="idx-collection-subtitle">
Discover our curated collections that bring you the best in style, quality, and comfort.
Explore unique themes, seasonal picks, and timeless designs crafted for every occasion.
</p>
<!-- Slider Wrapper -->
<div class="idx-collection-slider-wrapper">
<!-- Previous Button -->
<button class="idx-slider-nav-btn idx-slider-prev" id="idxCollectionPrev">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="2.5">
<path d="M15 18l-6-6 6-6"/>
</svg>
</button>
<!-- Swiper Container -->
<div class="idx-collection-swiper">
<div class="idx-collection-swiper-wrapper" id="idxCollectionWrapper">
<?php if (!empty($indexCollections)): ?>
<?php foreach ($indexCollections as $collection): ?>
<div class="idx-collection-slide">
<a href="shop?collection=<?= urlencode($collection['name']) ?>"
class="idx-collection-card">
<div class="idx-collection-img-wrapper">
<img src="../Images/Collections/<?= htmlspecialchars($collection['image']) ?>"
alt="<?= htmlspecialchars($collection['name']) ?>"
class="idx-collection-img">
<!-- Bottom Card with Title -->
<div class="idx-collection-info-card">
<h3 class="idx-collection-name">
<?= htmlspecialchars($collection['name']) ?>
</h3>
<div class="idx-collection-arrow">
View Collection
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M5 12h14M12 5l7 7-7 7"/>
</svg>
</div>
<div class="idx-collection-underline"></div>
</div>
</div>
</a>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="idx-collection-slide">
<div style="text-align: center; padding: 40px; color: #999;">
No collections available
</div>
</div>
<?php endif; ?>
</div>
</div>
<!-- Next Button -->
<button class="idx-slider-nav-btn idx-slider-next" id="idxCollectionNext">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="2.5">
<path d="M9 18l6-6-6-6"/>
</svg>
</button>
</div>
<!-- Pagination Dots -->
<div class="idx-slider-pagination" id="idxCollectionPagination"></div>
</div>
</section>
<!-- ============================================
JAVASCRIPT - Add this before closing </body> tag
============================================ -->
<script>
(function() {
const wrapper = document.getElementById('idxCollectionWrapper');
const prevBtn = document.getElementById('idxCollectionPrev');
const nextBtn = document.getElementById('idxCollectionNext');
const pagination = document.getElementById('idxCollectionPagination');
if (!wrapper || !prevBtn || !nextBtn || !pagination) return;
const slides = wrapper.querySelectorAll('.idx-collection-slide');
const totalSlides = slides.length;
if (totalSlides === 0) return;
let currentIndex = 0;
let slidesPerView = window.innerWidth <= 768 ? 1 : 2;
let totalPages = Math.ceil(totalSlides / slidesPerView);
// Create pagination dots
function createPagination() {
pagination.innerHTML = '';
for (let i = 0; i < totalPages; i++) {
const dot = document.createElement('button');
dot.className = 'idx-pagination-dot';
if (i === 0) dot.classList.add('active');
dot.setAttribute('aria-label', `Go to slide ${i + 1}`);
dot.addEventListener('click', () => goToPage(i));
pagination.appendChild(dot);
}
}
// Update pagination
function updatePagination() {
const dots = pagination.querySelectorAll('.idx-pagination-dot');
const currentPage = Math.floor(currentIndex / slidesPerView);
dots.forEach((dot, index) => {
dot.classList.toggle('active', index === currentPage);
});
}
// Update slider
function updateSlider() {
const slideWidth = 100 / slidesPerView;
const translateX = -(currentIndex * slideWidth);
wrapper.style.transform = `translateX(${translateX}%)`;
prevBtn.disabled = currentIndex === 0;
nextBtn.disabled = currentIndex >= totalSlides - slidesPerView;
updatePagination();
}
// Go to specific page
function goToPage(pageIndex) {
currentIndex = pageIndex * slidesPerView;
currentIndex = Math.max(0, Math.min(currentIndex, totalSlides - slidesPerView));
updateSlider();
}
// Previous
prevBtn.addEventListener('click', () => {
if (currentIndex > 0) {
currentIndex = Math.max(0, currentIndex - slidesPerView);
updateSlider();
}
});
// Next
nextBtn.addEventListener('click', () => {
if (currentIndex < totalSlides - slidesPerView) {
currentIndex = Math.min(totalSlides - slidesPerView, currentIndex + slidesPerView);
updateSlider();
}
});
// Keyboard navigation
document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowLeft' && !prevBtn.disabled) {
prevBtn.click();
} else if (e.key === 'ArrowRight' && !nextBtn.disabled) {
nextBtn.click();
}
});
// Touch support
let touchStartX = 0;
let touchEndX = 0;
wrapper.addEventListener('touchstart', (e) => {
touchStartX = e.changedTouches[0].screenX;
}, { passive: true });
wrapper.addEventListener('touchend', (e) => {
touchEndX = e.changedTouches[0].screenX;
handleSwipe();
}, { passive: true });
function handleSwipe() {
const diff = touchStartX - touchEndX;
if (Math.abs(diff) > 50) {
if (diff > 0 && !nextBtn.disabled) {
nextBtn.click();
} else if (diff < 0 && !prevBtn.disabled) {
prevBtn.click();
}
}
}
// Resize handler
let resizeTimer;
window.addEventListener('resize', () => {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(() => {
const newSlidesPerView = window.innerWidth <= 768 ? 1 : 2;
if (newSlidesPerView !== slidesPerView) {
slidesPerView = newSlidesPerView;
totalPages = Math.ceil(totalSlides / slidesPerView);
currentIndex = 0;
createPagination();
updateSlider();
}
}, 250);
});
// Initialize
createPagination();
updateSlider();
})();
</script>
<?php
// ========== SECTION 2: Handpicked Must-Haves ==========
$sql2 = "SELECT p.pid AS PID, p.pname AS PNAME, p.pthumb AS THUMBNAIL, p.pimg AS PIMG, p.category AS CNAME,
(SELECT pv.variant_title FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS VNAME,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS NEW_PRICE,
o.offer_id AS OFFER_ID, o.offer_amount AS OFFER_PRICE, o.offer_valid_until AS OFFER_VALID_UNTIL
FROM products p
LEFT JOIN tbl_offers o ON o.product_id = p.pid AND o.status = 'accepted' AND o.offer_valid_until > NOW()
" . (isset($_SESSION['user_id']) ? "AND o.user_id = " . (int)$_SESSION['user_id'] : "AND 1=0") . "
WHERE p.status IN ('approved','published') $genderWhere
ORDER BY p.pid DESC LIMIT 120";
$stmt2 = $pdo->prepare($sql2);
if ($gender !== 'all') {
$stmt2->bindValue(':gender', $gender);
}
$stmt2->execute();
$rows = $stmt2->fetchAll();
foreach ($rows as &$r) { $r['SINGLE_THUMB'] = firstFromPimg($r['PIMG'] ?? null); }
unset($r);
shuffle($rows);
$randomProducts = array_slice($rows, 0, 3);
$productClasses = ['kimonoProductCard', 'backTieProductCard', 'jetlineProductCard'];
?>
<style>
.fashionCollectionContainer {
background-color: #ffffff;
padding: 0px 0px;
}
.collectionMainHeading {
font-size: 28px;
font-weight: 500;
color: #1a1a1a;
margin-bottom: 50px;
line-height: 1.2;
max-width: 500px;
}
.productGridLayout {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
width: 100%;
}
.productCardWrapper {
position: relative;
border-radius: 4px;
overflow: hidden;
background-color: #f8f8f8;
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
}
.productCardWrapper:hover {
transform: translateY(-8px);
}
.productImageContainer {
width: 100%;
height: 597px;
overflow: hidden;
position: relative;
}
.productMainImage {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.4s ease;
}
.productCardWrapper:hover .productMainImage {
transform: scale(1.05);
}
.productInfoOverlay {
position: absolute;
bottom: 20px;
left: 20px;
width: 370px;
background: #f2f2f2;
backdrop-filter: none;
border-radius: 8px;
padding: 0;
display: flex;
align-items: stretch;
gap: 0;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
transition: all 0.3s ease;
overflow: hidden;
}
.productCardWrapper:hover .productInfoOverlay {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.productInfoOverlay a {
flex-shrink: 0;
}
.productThumbnailImage {
width: 72px;
height: 102px;
border-radius: 0;
object-fit: cover;
border: none;
flex-shrink: 0;
padding: 0;
margin: 0;
background: none;
display: block;
}
.productDetailsSection {
flex: 1;
padding: 12px 16px;
background-color: #f2f2f2;
display: flex;
flex-direction: column;
justify-content: center;
}
.brandNameText {
font-size: 11px;
font-weight: 500;
color: #999999;
margin-bottom: 3px;
text-transform: uppercase;
letter-spacing: 0.3px;
}
.productNameText {
font-size: 14px;
color: #1a1a1a;
margin-bottom: 5px;
line-height: 1.3;
font-weight: 500;
}
.productPriceText {
font-size: 14px;
color: #1a1a1a;
font-weight: 600;
}
.productInfoOverlay a:last-child {
background-color: #f2f2f2;
display: flex;
align-items: center;
justify-content: center;
padding: 0 16px;
flex-shrink: 0;
}
.actionArrowIcon {
width: 20px;
height: 20px;
color: #333333;
transition: all 0.3s ease;
flex-shrink: 0;
}
.productCardWrapper:hover .actionArrowIcon {
color: #2c5aa0;
transform: translateX(3px);
}
/* Specific styling for different product images */
.kimonoProductCard .productImageContainer {
background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
}
.backTieProductCard .productImageContainer {
background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
}
.jetlineProductCard .productImageContainer {
background: linear-gradient(135deg, #f9f9f9 0%, #f0f0f0 100%);
}
.collectionProgressContainer {
display: none;
}
@media (max-width: 1200px) {
.productGridLayout {
grid-template-columns: repeat(2, 1fr);
gap: 25px;
}
}
@media (max-width: 768px) {
.fashionCollectionContainer {
padding: 40px 20px;
}
.collectionMainHeading {
font-size: 24px;
margin-bottom: 10px;
}
.productGridLayout {
display: flex !important;
grid-template-columns: unset !important;
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
gap: 15px !important;
padding-bottom: 10px;
}
.productGridLayout::-webkit-scrollbar {
display: none;
}
.productCardWrapper {
flex: 0 0 85vw !important;
max-width: 85vw !important;
scroll-snap-align: start;
}
.productImageContainer {
height: 400px;
}
.productInfoOverlay {
bottom: 15px;
left: 15px;
width: calc(100% - 30px);
max-width: 370px;
}
.productThumbnailImage {
width: 60px;
height: 85px;
}
.productDetailsSection {
padding: 10px 14px;
}
.productInfoOverlay a:last-child {
padding: 0 14px;
}
.actionArrowIcon {
width: 18px;
height: 18px;
}
.collectionProgressContainer {
display: block;
margin-top: 30px;
width: 100%;
}
.collectionProgressBar {
width: 100%;
height: 2px;
background-color: #e5e5e5;
overflow: hidden;
position: relative;
margin: 0 auto;
}
.collectionProgressFill {
height: 100%;
background-color: #333;
transition: width 0.2s ease;
width: 0%;
}
}
</style>
<div class="fashionCollectionContainer mt-smm-00" style="margin-top:150px">
<h1 class="collectionMainHeading">Handpicked Must-Haves Across All Our Collections</h1>
<div class="productGridLayout">
<?php foreach ($randomProducts as $index => $row):
$displayImg = ($row['THUMBNAIL'] === '' ? ($row['SINGLE_THUMB'] ?: 'default.jpg') : $row['THUMBNAIL']);
$thumbPath = $imageUrl . '/' . $displayImg;
$brand = $row['CNAME'] ?: 'Swipe Modern';
$name = $row['PNAME'] ?? '';
$words = preg_split('/\s+/', trim($name));
$truncated = '';
if ($words) {
$truncated = implode(' ', array_slice($words, 0, 3));
if (count($words) > 3) $truncated .= '...';
}
$detailsUrl = 'product_details.php?product=' . makeUrl($row['PNAME']) . '&variant=' . makeUrl($row['VNAME']) . '&pid=' . (int)$row['PID'];
$hasOffer = !empty($row['OFFER_ID']) && !empty($row['OFFER_VALID_UNTIL']);
$offerPrice = $hasOffer ? $row['OFFER_PRICE'] : null;
$offerValidUntil = $hasOffer ? $row['OFFER_VALID_UNTIL'] : null;
$displayPrice = $hasOffer ? $offerPrice : $row['NEW_PRICE'];
?>
<div class="productCardWrapper <?php echo $productClasses[$index] ?? ''; ?>" onclick="window.location.href='<?php echo htmlspecialchars($detailsUrl); ?>';" style="cursor:pointer">
<div class="productImageContainer">
<img src="<?php echo htmlspecialchars($thumbPath); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="productMainImage" />
<?php if ($hasOffer): ?>
<div class="offer-badge-common">Offer Product</div>
<?php endif; ?>
</div>
<div class="productInfoOverlay">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" class="d-block" onclick="event.stopPropagation();">
<img src="<?php echo htmlspecialchars($thumbPath); ?>" alt="Thumbnail" class="productThumbnailImage" />
</a>
<div class="productDetailsSection">
<div class="brandNameText"><?php echo htmlspecialchars($brand); ?></div>
<div class="productNameText"><?php echo htmlspecialchars($truncated ?: $name); ?></div>
<?php if ($hasOffer): ?>
<div class="offer-price-row-wrapper">
<div class="productPriceText offer-price-common">₹<?php echo number_format((float)$displayPrice, 2); ?></div>
<div class="offer-timer-common" data-offer-end="<?php echo $offerValidUntil; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="productPriceText">₹<?php echo number_format((float)$displayPrice, 2); ?></div>
<?php endif; ?>
</div>
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" onclick="event.stopPropagation();">
<svg class="actionArrowIcon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3"></path>
</svg>
</a>
</div>
</div>
<?php endforeach; ?>
</div>
<!--<div class="collectionProgressContainer">-->
<!-- <div class="collectionProgressBar">-->
<!-- <div class="collectionProgressFill" id="collectionProgressFill"></div>-->
<!-- </div>-->
<!--</div>-->
</div>
<!-- ========== BRAND MARQUEE SECTION ========== -->
<style>
.eco-features-wrapper {
padding: 120px 0;
position: relative;
background: black;
margin: 150px 0;
border-radius:15px;
}
.eco-feature-card {
text-align: left;
padding: 30px 20px;
}
.eco-icon-container {
width: 90px;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20px;
}
.eco-feature-icon {
font-size: 3px;
color: white;
}
.eco-feature-title {
font-size: 24px;
color: white;
margin-bottom: 10px;
line-height: 1.1;
}
.eco-feature-description {
font-size: 15px;
color: #ccc;
line-height: 1.4;
margin-bottom: 0;
}
.eco-features-container {
margin: 0 auto;
max-width: 1600px;
}
.progress-bar-container {
display: none;
}
.progress-bar-fill {
flex: 1;
height: 100%;
background: transparent;
position: relative;
}
.progress-bar-fill::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
transition: background-color 0.3s ease;
}
.progress-bar-fill.active::after {
background-color: #000;
}
@media (max-width: 400px) {
.pb-smm-40{
padding-bottom: 40px !important;
}
.pb-smm-60{
padding-bottom: 60px !important;
}
.eco-features-wrapper{
padding: 20px 0;
}
.eco-features-wrapper {
padding-bottom: 10px;
margin-bottom: 20px;
}
.eco-feature-card {
margin-bottom: 30px;
background-color: #f8f9fa;
border-radius: 8px;
}
.eco-feature-title {
font-size: 20px;
}
.eco-feature-description {
font-size: 14px;
}
.eco-features-container {
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
-ms-overflow-style: none;
}
.eco-features-container::-webkit-scrollbar {
display: none;
}
.eco-features-container .row {
flex-wrap: nowrap;
width: max-content;
}
.eco-features-container .col-lg-3,
.eco-features-container .col-md-6,
.eco-features-container .col-sm-12 {
flex: 0 0 85vw;
max-width: 85vw;
scroll-snap-align: center;
padding-left: 5px;
padding-right: 5px;
}
.progress-bar-container {
display: flex;
width: 320px;
height: 1px;
background: transparent;
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
gap: 0;
}
}
</style>
<div class="eco-features-wrapper">
<div class="container eco-features-container cf-sm-pl-10" id="featuresContainer">
<div class="row g-4">
<!-- Sustainable Materials -->
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="eco-feature-card">
<div class="eco-icon-container">
<svg
class="eco-feature-icon"
aria-hidden="true"
focusable="false"
width="70"
height="70"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="transparent"
>
<path
d="M11.854 3.86448C12.2889 3.86448 12.6402 4.23715 12.6402 4.69855V8.09395C12.6402 9.86856 13.9337 11.3237 15.5784 11.4539C15.7066 11.4657 15.8181 11.3592 15.8181 11.2173V6.64469C15.8181 4.78136 14.3964 3.27295 12.6402 3.27295H11.3021H10.4212H9.71308C8.04046 3.27295 6.66892 4.64531 6.54626 6.39034C6.53511 6.52639 6.63546 6.64469 6.76927 6.64469H8.12409C9.49564 6.64469 10.6665 5.7219 11.1125 4.42644C11.224 4.08927 11.5195 3.86448 11.854 3.86448Z"
fill="currentColor"
></path>
<path
d="M3.86424 12.1462C3.86424 11.7114 4.23691 11.3601 4.6983 11.3601H8.09371C9.86831 11.3601 11.3235 10.0666 11.4536 8.42187C11.4655 8.29364 11.359 8.18213 11.217 8.18213H6.64445C4.78112 8.18213 3.27271 9.60385 3.27271 11.3601V12.6982V13.5791V14.2872C3.27271 15.9598 4.64506 17.3314 6.39009 17.454C6.52614 17.4652 6.64445 17.3648 6.64445 17.231V15.8762C6.64445 14.5046 5.72166 13.3338 4.4262 12.8878C4.08902 12.7763 3.86424 12.4808 3.86424 12.1462Z"
fill="currentColor"
></path>
<path
d="M12.146 20.1362C11.7111 20.1362 11.3599 19.7635 11.3599 19.3021V15.9067C11.3599 14.1321 10.0664 12.6769 8.42163 12.5468C8.29339 12.535 8.18188 12.6414 8.18188 12.7834V17.356C8.18188 19.2193 9.60361 20.7277 11.3599 20.7277H12.698H13.5789H14.2869C15.9596 20.7277 17.3311 19.3554 17.4538 17.6103C17.4649 17.4743 17.3646 17.356 17.2307 17.356H15.8759C14.5044 17.356 13.3335 18.2788 12.8875 19.5742C12.776 19.9114 12.4805 20.1362 12.146 20.1362Z"
fill="currentColor"
></path>
<path
d="M17.6098 6.54674C17.4738 6.53559 17.3555 6.63595 17.3555 6.76976V8.12458C17.3555 9.49613 18.2783 10.667 19.5737 11.113C19.905 11.2301 20.1357 11.52 20.1357 11.8545C20.1357 12.2894 19.763 12.6407 19.3016 12.6407H15.9062C14.1316 12.6407 12.6764 13.9341 12.5463 15.5789C12.5345 15.7071 12.641 15.8186 12.7829 15.8186H17.3555C19.2188 15.8186 20.7272 14.3969 20.7272 12.6407V11.3026V10.4216V9.71357C20.7272 8.04095 19.3549 6.6694 17.6098 6.54674Z"
fill="currentColor"
></path>
</svg>
</div>
<h3 class="eco-feature-title">Sustainable Materials</h3>
<p class="eco-feature-description">
Thoughtfully crafted from eco-friendly fabrics for a better future.
</p>
</div>
</div>
<!-- Secure Payment -->
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="eco-feature-card">
<div class="eco-icon-container">
<svg
class="eco-feature-icon"
aria-hidden="true"
focusable="false"
width="70"
height="70"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="transparent"
>
<path
d="M17.7552 10.2792C17.633 6.45337 14.533 3.36598 10.6942 3.27295C10.5954 3.27295 10.5139 3.34854 10.5139 3.44738L10.5081 6.0173C10.5081 6.14522 10.4092 6.24406 10.2813 6.24987C6.45419 6.36616 3.36576 9.471 3.27271 13.3084C3.27271 13.4073 3.34832 13.4887 3.44719 13.4887L6.01216 13.4945C6.14011 13.4945 6.23899 13.5933 6.24481 13.7213C6.36695 17.5471 9.47282 20.6345 13.3057 20.7275C13.4046 20.7275 13.486 20.6519 13.486 20.5531L13.4918 17.9831C13.4918 17.8552 13.5907 17.7564 13.7187 17.7506C17.5458 17.6285 20.6342 14.5236 20.7273 10.692C20.7273 10.5932 20.6516 10.5118 20.5528 10.5118L17.9878 10.5059C17.8598 10.5059 17.761 10.4071 17.7552 10.2792ZM13.2359 17.7331C11.0607 17.6052 9.31578 15.8377 9.23435 13.6515C9.22854 13.5585 9.15293 13.4829 9.05987 13.4829L6.50072 13.4771C6.36695 13.4771 6.26225 13.3666 6.26807 13.2329C6.39603 11.0583 8.16417 9.31401 10.3511 9.23261C10.4441 9.2268 10.5197 9.15121 10.5197 9.05818L10.5256 6.49407C10.5256 6.36035 10.6361 6.25569 10.7698 6.2615C12.9451 6.38942 14.69 8.15697 14.7714 10.3431C14.7772 10.4362 14.8528 10.5118 14.9459 10.5118L17.5051 10.5176C17.6388 10.5176 17.7435 10.628 17.7377 10.7618C17.6097 12.9945 15.7544 14.7678 13.4918 14.7678L13.486 17.5006C13.4802 17.6343 13.3697 17.7389 13.2359 17.7331Z"
fill="currentColor"
></path>
</svg>
</div>
<h3 class="eco-feature-title">Secure Payment</h3>
<p class="eco-feature-description">
Shop with confidence using our safe and encrypted checkout.
</p>
</div>
</div>
<!-- 30 Days Free Returns -->
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="eco-feature-card">
<div class="eco-icon-container">
<svg
class="eco-feature-icon"
aria-hidden="true"
focusable="false"
width="70"
height="70"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="transparent"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2.72737 11.9691C2.71197 14.9897 5.1546 17.4545 8.16682 17.4545C9.3984 17.4545 10.5838 17.0377 11.5434 16.2761H11.5588L17.7885 10.6569C17.029 9.81299 15.7307 9.74095 14.8892 10.5025L10.3939 14.5574C9.77813 15.0977 8.98787 15.3962 8.16682 15.3962C6.28354 15.3962 4.7492 13.8473 4.77999 11.9485C4.81078 10.0857 6.36051 8.60373 8.21814 8.60373H9.62932C10.7634 8.60373 11.6819 7.68263 11.6819 6.54541H8.2284C5.22644 6.54541 2.74276 8.95879 2.72737 11.9691ZM12.7134 17.4545H16.1669C19.1638 17.4545 21.6474 15.0411 21.6628 12.0308C21.6782 9.01025 19.2356 6.54541 16.2234 6.54541C14.9969 6.54541 13.8064 6.96222 12.8468 7.7238L12.6313 7.9039C12.621 7.91419 12.6095 7.92449 12.5979 7.93478C12.5864 7.94507 12.5748 7.95536 12.5646 7.96565L6.6017 13.343C7.36117 14.1869 8.65945 14.259 9.50103 13.4974L13.9963 9.44249C14.6121 8.90219 15.4023 8.60373 16.2234 8.60373C18.1067 8.60373 19.641 10.1526 19.6102 12.0514C19.5794 13.9142 18.0297 15.3962 16.1721 15.3962H14.766C13.6319 15.3962 12.7134 16.3173 12.7134 17.4545Z"
fill="currentColor"
></path>
</svg>
</div>
<h3 class="eco-feature-title">30 Days Free Returns</h3>
<p class="eco-feature-description">
Not the right fit? Return or exchange your order for free within 30 days.
</p>
</div>
</div>
<!-- Worldwide Shipping -->
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="eco-feature-card">
<div class="eco-icon-container">
<svg
class="eco-feature-icon"
aria-hidden="true"
focusable="false"
width="70"
height="70"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="transparent"
>
<path
d="M20.602 16.5457C20.2353 16.3362 19.8978 16.0859 19.5893 15.8007L19.5777 15.7891L19.5719 15.7832C18.4602 14.7473 17.8258 13.3447 17.7735 11.8256C17.7269 10.3066 18.274 8.86322 19.3158 7.76323L19.3332 7.73995C19.8512 7.18123 20.3052 6.57594 20.6893 5.9241C20.7533 5.81934 20.7184 5.67966 20.6136 5.61564L19.5544 4.96961C19.4496 4.90559 19.3041 4.94051 19.2459 5.04527C18.9258 5.59236 18.5417 6.10452 18.1052 6.57594C18.0936 6.58758 18.0877 6.5934 18.0761 6.60504C18.0761 6.60504 18.0761 6.60504 18.0703 6.61086C18.0703 6.61086 18.0703 6.61086 18.0645 6.61668C16.8772 7.87963 15.364 8.76428 13.6936 9.16004C13.1116 9.29972 12.5063 9.3812 11.901 9.39866C11.191 9.42194 10.5508 8.99126 10.2772 8.3336C10.2365 8.24048 10.1958 8.14154 10.155 8.04841C10.0968 7.92619 10.2016 7.78651 10.3354 7.80979C10.8302 7.89709 11.3423 7.93201 11.8603 7.92037C13.8333 7.85635 15.6608 7.02991 17.0052 5.58654L17.0227 5.56908C17.3893 5.17331 17.7094 4.73681 17.983 4.27703C18.047 4.17227 18.0121 4.03259 17.9073 3.96857L16.8481 3.32254C16.7375 3.25852 16.5978 3.29344 16.5338 3.40402C16.3243 3.77068 16.074 4.10825 15.783 4.41671L15.7655 4.43417C14.7296 5.5458 13.3269 6.18018 11.8079 6.23256C10.2947 6.2733 8.85134 5.72622 7.74553 4.68443L7.73389 4.67279L7.72807 4.66697C7.16934 4.14899 6.56406 3.69502 5.91222 3.30508C5.80745 3.24106 5.66777 3.27598 5.60375 3.38074L4.95773 4.44581C4.89371 4.55057 4.92863 4.69607 5.03339 4.75427C5.58629 5.08019 6.09846 5.46432 6.56988 5.90082L6.5757 5.90664L6.58152 5.91246C7.85029 7.09975 8.73494 8.61878 9.14234 10.295C9.28202 10.877 9.3635 11.4764 9.38096 12.0817C9.38096 12.0875 9.38096 12.0933 9.38096 12.0992C9.40424 12.8034 8.96774 13.4436 8.31589 13.7113C8.22277 13.7521 8.12383 13.7928 8.03071 13.8335C7.90849 13.8917 7.76881 13.787 7.79209 13.6531C7.87939 13.1584 7.91431 12.6462 7.90267 12.1283C7.84447 10.1669 7.02384 8.34524 5.58629 7.00081C5.57465 6.98917 5.56301 6.97753 5.54555 6.96589C5.14979 6.60504 4.71911 6.28494 4.25932 6.01722C4.15456 5.9532 4.01488 5.98812 3.95086 6.09288L3.31066 7.15213C3.24664 7.26271 3.28156 7.40239 3.39214 7.46641C3.75298 7.67593 4.09636 7.92619 4.40482 8.21138L4.4281 8.22884C5.53973 9.2648 6.17412 10.6674 6.2265 12.1865C6.27306 13.7055 5.72597 15.143 4.68419 16.2489L4.66091 16.2721C4.14292 16.8309 3.68896 17.4361 3.30484 18.088C3.24082 18.1927 3.27574 18.3324 3.3805 18.3964L4.43975 19.0425C4.54451 19.1065 4.68419 19.0716 4.74821 18.9668C5.06831 18.4197 5.45243 17.9076 5.88894 17.4361C5.90058 17.4245 5.9064 17.4187 5.91804 17.407C5.91804 17.407 5.91804 17.407 5.91804 17.4012C7.10532 16.1383 8.61853 15.2536 10.2947 14.852C10.8767 14.7124 11.482 14.6309 12.0873 14.6134C12.7973 14.5901 13.4375 15.0208 13.7111 15.6785C13.7518 15.7716 13.7926 15.8706 13.8333 15.9637C13.8915 16.0859 13.7867 16.2256 13.6529 16.2023C13.1582 16.115 12.646 16.0801 12.128 16.0917C10.155 16.1557 8.33335 16.9822 6.98892 18.4197L6.97146 18.4372L6.96564 18.443C6.59898 18.8388 6.27888 19.2753 6.00534 19.7351C5.94132 19.8398 5.97624 19.9795 6.081 20.0435L7.14024 20.6895C7.25082 20.7536 7.39051 20.7186 7.45453 20.6081C7.66405 20.2414 7.91431 19.9038 8.19949 19.5954L8.21113 19.5837L8.21695 19.5779C9.25292 18.4663 10.6555 17.8319 12.1746 17.7795C13.6936 17.733 15.137 18.28 16.237 19.3218L16.2602 19.3393C16.819 19.8573 17.4243 20.3112 18.0761 20.6954C18.1809 20.7594 18.3205 20.7245 18.3846 20.6197L19.0306 19.5605C19.0946 19.4557 19.0597 19.3102 18.9549 19.252C18.402 18.9261 17.8899 18.5419 17.4184 18.1113C17.4126 18.1054 17.4068 18.0996 17.401 18.0938L17.3952 18.088C16.1264 16.9007 15.2476 15.3875 14.846 13.7113C14.7063 13.1293 14.6248 12.5298 14.6074 11.9246C14.6074 11.9187 14.6074 11.9129 14.6074 11.9071C14.5841 11.2029 15.0206 10.5627 15.6724 10.295C15.7655 10.2542 15.8645 10.2135 15.9576 10.1727C16.0798 10.1145 16.2195 10.2193 16.1962 10.3532C16.1089 10.8479 16.074 11.36 16.0856 11.878C16.1497 13.8452 16.9761 15.6727 18.4137 17.0171L18.4195 17.0229L18.4311 17.0346L18.4369 17.0404C18.8327 17.407 19.2692 17.7271 19.729 18.0007C19.8338 18.0647 19.9734 18.0298 20.0375 17.925L20.6835 16.8658C20.7475 16.7494 20.7126 16.6097 20.602 16.5457ZM12.0407 12.9256C12.0291 12.9256 12.0174 12.9256 12.0058 12.9256C11.5053 12.9431 11.0921 12.5473 11.0804 12.0468C11.0804 12.041 11.0804 12.041 11.0804 12.0351C11.0804 12.0293 11.0804 12.0293 11.0804 12.0235C11.063 11.523 11.4587 11.1039 11.9592 11.0865C11.9651 11.0865 11.9651 11.0865 11.9709 11.0865C11.9767 11.0865 11.9767 11.0865 11.9825 11.0865C12.483 11.069 12.9021 11.4648 12.9195 11.9653C12.9195 11.9711 12.9195 11.9711 12.9195 11.9769C12.9195 11.9828 12.9195 11.9828 12.9195 11.9886C12.9254 12.4891 12.5412 12.9081 12.0407 12.9256Z"
fill="currentColor"
></path>
</svg>
</div>
<h3 class="eco-feature-title">Worldwide Shipping</h3>
<p class="eco-feature-description">
We ship to over 100 countries with fast and reliable delivery options.
</p>
</div>
</div>
</div>
</div>
<div class="progress-bar-container">
<div class="progress-bar-fill" id="progressBar"></div>
</div>
</div>
<?php
// ========== SECTION 3: More to Love (Categories) ==========
$catSql = "SELECT p.category AS CNAME, COUNT(*) AS CNT FROM products p
WHERE p.status IN ('approved','published') AND p.category IS NOT NULL AND p.category <> '' $genderWhere
GROUP BY p.category ORDER BY CNT DESC, CNAME ASC LIMIT 5";
$catStmt = $pdo->prepare($catSql);
if ($gender !== 'all') {
$catStmt->bindValue(':gender', $gender);
}
$catStmt->execute();
$categories = $catStmt->fetchAll();
if ($categories) {
$productsByCategory = [];
$productSql = "SELECT p.pid AS PID, p.pname AS PNAME, p.pthumb AS THUMBNAIL, p.pimg AS PIMG, p.pdes AS PDES, p.category AS CNAME,
(SELECT pv.variant_title FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS VNAME,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS NEW_PRICE,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price DESC LIMIT 1) AS OLD_PRICE,
o.offer_id AS OFFER_ID, o.offer_amount AS OFFER_PRICE, o.offer_valid_until AS OFFER_VALID_UNTIL
FROM products p
LEFT JOIN tbl_offers o ON o.product_id = p.pid AND o.status = 'accepted' AND o.offer_valid_until > NOW()
" . (isset($_SESSION['user_id']) ? "AND o.user_id = " . (int)$_SESSION['user_id'] : "AND 1=0") . "
WHERE p.status IN ('approved','published') AND p.category = ? ORDER BY p.pid DESC LIMIT 12";
$productStmt = $pdo->prepare($productSql);
foreach ($categories as $cat) {
$productStmt->execute([$cat['CNAME']]);
$rows = $productStmt->fetchAll();
foreach ($rows as &$r) {
$hover = getFirstGalleryImage($pdo, (int)$r['PID'], $r['PIMG'] ?? null);
$r['gallery_img'] = $hover ?: '';
$r['SINGLE_THUMB'] = firstFromPimg($r['PIMG'] ?? null);
}
unset($r);
$productsByCategory[$cat['CNAME']] = $rows;
}
?>
<style>
/* ========== Product Actions ========== */
.product-actions {
display: flex;
align-items: center;
gap: 0;
margin-top: 8px;
}
.btn-shop,
.btn-quick-view {
background: none;
border: none;
color: #666;
font-size: 14px;
text-decoration: none;
margin: 0;
}
.btn-shop {
padding-right: 8px;
border-right: 1px solid #ccc;
}
.btn-quick-view {
padding-left: 8px;
}
.btn-shop:hover,
.btn-quick-view:hover {
color: #000;
}
/* ========== Product Price ========== */
.product-price {
font-size: 14px;
font-weight: 500;
color: #000;
display: flex;
align-items: center;
gap: 8px;
}
.product-price .original-price {
text-decoration: line-through;
color: #999;
font-size: 13px;
}
/* ========== Navigation Pills ========== */
.nav-pills {
border-radius: 25px;
padding: 5px;
box-shadow: none;
gap: 10px;
flex-wrap: nowrap;
}
.nav-pills .nav-link {
border-radius: 6px;
color: black;
font-weight: 500;
padding: 8px 20px;
background: transparent;
transition: all 0.3s ease;
border: 1px solid rgb(222, 222, 222);
gap: 20px;
display: flex;
font-size: 14px;
white-space: nowrap;
}
.nav-pills .nav-link.active {
background: #f2f2f2;
color: #333;
box-shadow: none;
}
/* ========== Product Card ========== */
.product-card {
overflow: hidden;
transition: transform 0.3s ease;
border: none;
height: 100%;
box-shadow: none;
}
.product-card:hover {
transform: translateY(-5px);
box-shadow: none;
}
.product-image {
position: relative;
height: 620px;
width: 100% !important;
}
.product-image .main-image,
.product-image .hover-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
transition: opacity 0.3s ease;
border-radius: 10px;
}
.product-image .hover-image {
opacity: 0;
}
.product-card:hover .product-image .main-image {
opacity: 0;
}
.product-card:hover .product-image .hover-image {
opacity: 1;
}
.add-to-cart-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 60px 20px 20px;
transform: translateY(100%);
transition: transform 0.3s ease;
opacity: 0;
}
.product-card:hover .add-to-cart-overlay {
transform: translateY(0);
opacity: 1;
}
.btn-add-to-cart {
background: #000;
color: white;
border: none;
border-radius: 8px;
padding: 12px;
width: 100%;
font-weight: 500;
transition: background 0.3s ease;
box-shadow: none;
}
.btn-add-to-cart:hover {
background: #333;
color: white;
font-family: var(--font-body);
}
/* ========== Product Info ========== */
.product-info {
padding: 20px 0;
position: relative;
}
.product-brand {
color: black;
font-size: 14px;
margin-bottom: 5px;
font-family: var(--font-body);
}
.product-title {
font-size: 13px;
margin-bottom: 10px;
color: #666666;
font-family: var(--font-body);
}
.product-price {
font-size: 14px;
color: black;
transition: opacity 0.3s ease;
font-weight: 500;
font-family: var(--font-body);
}
.product-actions {
position: absolute;
bottom: 20px;
left: 0;
right: 0;
display: flex;
gap: 15px;
opacity: 0;
transition: opacity 0.3s ease;
}
.product-card:hover .product-price {
opacity: 0;
}
.product-card:hover .product-actions {
opacity: 1;
}
/* ========== Modal Styles ========== */
/*.modal-content {*/
/* border: none;*/
/* border-radius: 12px;*/
/* box-shadow: none;*/
/* max-width: 1100px;*/
/* margin: auto;*/
/*}*/
/*.modal-dialog {*/
/* display: flex;*/
/* align-items: center;*/
/* min-height: 100vh;*/
/* margin: 0;*/
/*max-width: 100%;*/
/* padding: 20px;*/
/*}*/
/*.modal-header {*/
/* border: none;*/
/* padding: 20px 20px 0;*/
/* position: absolute;*/
/* top: 0;*/
/* right: 0;*/
/* z-index: 10;*/
/*}*/
.product-slider {
position: relative;
height: 100%;
}
.slider-nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(255, 255, 255, 0.9);
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
transition: background 0.3s ease;
box-shadow: none;
}
.slider-nav:hover {
background: white;
box-shadow: none;
}
.slider-prev {
left: 10px;
}
.slider-next {
right: 10px;
}
.modal-product-image {
width: 100%;
height: 500px;
object-fit: cover;
border-radius: 8px 0 0 8px;
padding: 0;
box-shadow: none;
}
.modal-product-title {
font-size: 28px;
font-weight: 700;
margin-bottom: 10px;
}
.modal-product-price {
font-size: 24px;
font-weight: 700;
margin-bottom: 15px;
}
.shipping-info {
color: #666;
font-size: 14px;
margin-bottom: 20px;
}
.btn-view-details {
color: #666;
text-decoration: underline;
background: none;
border: none;
font-size: 14px;
margin-top: 15px;
}
/* Remove all box shadows globally */
/** {*/
/* box-shadow: none !important;*/
/*}*/
.fashion-view-all {
display: inline-block;
}
/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
/* Header - Keep title at top, hide view all temporarily */
.d-flex.justify-content-between {
position: relative;
}
.d-flex.justify-content-between h2 {
margin-bottom: 0 !important;
font-size: 20px;
width: 100%;
}
/* Hide desktop View All button on mobile */
.d-flex.justify-content-between .fashion-view-all {
display: none;
}
/* Tab Navigation - Horizontal Scroll with active tab visible */
.nav-pills {
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
padding: 5px 10px;
margin-bottom: 20px !important;
display: flex;
scroll-behavior: smooth;
width: 100%;
margin-left: -10px;
margin-right: -10px;
}
.nav-pills::-webkit-scrollbar {
display: none;
}
.nav-pills .nav-item {
flex-shrink: 0;
}
.nav-pills .nav-item:first-child {
margin-left: 10px;
}
.nav-pills .nav-item:last-child {
margin-right: 10px;
}
/* Product Grid - Horizontal Scroll */
.row.g-3 {
display: flex !important;
flex-wrap: nowrap !important;
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
gap: 15px !important;
margin: 0 !important;
padding-bottom: 10px;
}
.row.g-3::-webkit-scrollbar {
display: none;
}
.row.g-3 > div {
flex: 0 0 50vw !important;
max-width: 50vw !important;
scroll-snap-align: start;
padding: 0 !important;
}
.product-image {
height: 220px;
}
/* Mobile View All Button - Full width at bottom */
#mobileViewAll {
display: none !important;
}
@media (max-width: 768px) {
#mobileViewAll {
display: block !important;
width: 100%;
padding: 12px;
text-align: center;
background: #f2f2f2;
color: black !important;
border-radius: 4px;
text-decoration: none;
font-size: 14px;
font-weight: 500;
}
}
}
</style>
<div class="cf-sm-pl-10 mt-smm-00 pb-smm-60" style="padding-bottom:150px">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="mb-0" style="font-size: 28px;">More to Love</h2>
<a href="../user/shop" class="fashion-view-all btn-effect-light">View All</a>
</div>
<ul class="nav nav-pills mb-4" id="productTabs">
<?php foreach ($categories as $i => $row): ?>
<li class="nav-item">
<a class="nav-link btn-effect-light <?php echo $i === 0 ? 'active' : ''; ?>" data-bs-toggle="pill" data-bs-target="#nav-tab<?php echo $i; ?>" type="button">
<?php echo htmlspecialchars($row['CNAME']); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<div class="tab-content" id="mainTabContent">
<?php foreach ($categories as $i => $rw): ?>
<div class="tab-pane fade show <?php echo $i === 0 ? 'active' : ''; ?>" id="nav-tab<?php echo $i; ?>">
<div class="row g-3">
<?php $list = $productsByCategory[$rw['CNAME']] ?? []; ?>
<?php foreach ($list as $row):
$detailsUrl = 'product_details.php?product=' . makeUrl($row['PNAME']) . '&variant=' . makeUrl($row['VNAME']) . '&pid=' . (int)$row['PID'];
$mainImage = ($row['THUMBNAIL'] === '' ? ($row['SINGLE_THUMB'] ?: '') : $row['THUMBNAIL']);
$hoverImage = trim((string)($row['gallery_img'] ?? ''));
$hasOffer = !empty($row['OFFER_ID']) && !empty($row['OFFER_VALID_UNTIL']);
$offerPrice = $hasOffer ? $row['OFFER_PRICE'] : null;
$offerValidUntil = $hasOffer ? $row['OFFER_VALID_UNTIL'] : null;
$displayPrice = $hasOffer ? $offerPrice : $row['NEW_PRICE'];
?>
<div class="col-lg-3 col-md-6 col-6">
<div class="card product-card" onclick="window.location.href='<?php echo htmlspecialchars($detailsUrl); ?>';" style="cursor:pointer">
<div class="product-image">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" class="d-block">
<img src="<?php echo $imageUrl . '/' . htmlspecialchars($mainImage); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="main-image" />
<?php if ($hoverImage !== ''): ?>
<img src="<?php echo $imageUrl . '/' . htmlspecialchars($hoverImage); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="hover-image" />
<?php endif; ?>
</a>
<?php if ($hasOffer): ?>
<div class="offer-badge-common">Offer Product</div>
<?php endif; ?>
</div>
<div class="product-info">
<div class="product-brand"><?php echo htmlspecialchars($row['CNAME']); ?></div>
<div class="product-title">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" onclick="event.stopPropagation();" class="text-decoration-none text-dark">
<?php echo htmlspecialchars($row['PNAME']); ?>
</a>
</div>
<?php if ($hasOffer): ?>
<div class="offer-price-row-wrapper">
<div class="product-price offer-price-common">₹ <?php echo number_format((float)$displayPrice, 2); ?></div>
<div class="offer-timer-common" data-offer-end="<?php echo $offerValidUntil; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="product-price">₹ <?php echo number_format((float)$displayPrice, 2); ?></div>
<?php endif; ?>
<div class="product-actions">
<a href="<?php echo htmlspecialchars($detailsUrl); ?>" class="btn-shop" onclick="event.stopPropagation();">Shop Now</a>
<button class="btn-quick-view"
onclick="event.stopPropagation(); openQuickView(<?php echo $row['PID']; ?>)"
data-bs-toggle="modal"
data-bs-target="#productModal"
data-id='<?php echo $row['PID']; ?>'
data-image='<?php echo $mainImage; ?>'
data-pname='<?php echo htmlspecialchars($row['PNAME']); ?>'
data-vname='<?php echo htmlspecialchars($row['VNAME']); ?>'
data-des='<?php echo htmlspecialchars($row['PDES']); ?>'
data-price='₹<?php echo number_format($displayPrice, 2); ?>'
data-old-price='₹<?php echo number_format($row['OLD_PRICE'], 2); ?>'
data-cname='<?php echo htmlspecialchars($row['CNAME']); ?>'
data-product-url='<?php echo $detailsUrl; ?>'>
Quick View
</button>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<a href="../user/shop" class="fashion-view-all btn-effect-light" id="mobileViewAll" style="display: none;">View All</a>
</div>
<style>
.brand-logos-section {
text-align: center;
padding-bottom: 150px;
background: #fff;
}
.brand-logos-section h2 {
font-size: 1.8rem;
font-weight: 600;
margin-bottom: 10px;
color: #000;
}
.brand-logos-section p {
color: #555;
/*margin-bottom: 35px;*/
font-size: 1rem;
}
.brand-logos-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
gap: 15px;
justify-items: center;
align-items: center;
max-width: 1500px;
margin: 0 auto;
}
.brand-logo-item {
background: #fff;
width: 100%;
aspect-ratio: 5 / 4;
display: flex;
justify-content: center;
align-items: center;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.brand-logo-item:hover {
transform: translateY(-2px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.brand-logo-image {
width: 70%; /* 🔹 slightly larger logos */
height: auto; /* 🔹 maintain aspect ratio, no stretching */
object-fit: contain; /* 🔹 ensures proportional scaling */
filter: grayscale(100%);
transition: filter 0.3s ease;
}
.brand-logo-item:hover .brand-logo-image {
filter: grayscale(0%);
}
@media (max-width: 768px) {
.brand-logos-grid {
gap: 12px;
}
.brand-logo-item {
aspect-ratio: unset !important;
}
.brand-logo-image {
width: 45%;
}
}
</style>
<!-- Display Brand Logos -->
<div class="brand-logos-section">
<h2>THOUSANDS OF BRANDS. FROM CULT TO CLASSIC.</h2>
<p>All quality checked by us.</p>
<div class="brand-logos-grid">
<?php foreach ($brandLogos as $brand): ?>
<div class="brand-logo-item">
<img src="<?php echo $imageUrlbanner . '/' . htmlspecialchars($brand['logo']); ?>"
alt="Brand Logo"
class="brand-logo-image">
</div>
<?php endforeach; ?>
</div>
</div>
<?php } ?>
<?php
// ========== SECTION 4: New Collection Slider ==========
$limit = 8;
$sql4 = "SELECT p.pid AS PID, p.pname AS PNAME, p.pthumb AS PTHUMB, p.pimg AS PIMG, p.category AS CATEGORY,
(SELECT pv.price FROM product_variations pv WHERE pv.PID = p.pid ORDER BY pv.price ASC LIMIT 1) AS PRICE,
o.offer_id AS OFFER_ID, o.offer_amount AS OFFER_PRICE, o.offer_valid_until AS OFFER_VALID_UNTIL
FROM products p
LEFT JOIN tbl_offers o ON o.product_id = p.pid AND o.status = 'accepted' AND o.offer_valid_until > NOW()
" . (isset($_SESSION['user_id']) ? "AND o.user_id = " . (int)$_SESSION['user_id'] : "AND 1=0") . "
WHERE p.status IN ('approved','published') $genderWhere ORDER BY RAND() LIMIT :lim";
$st = $pdo->prepare($sql4);
if ($gender !== 'all') {
$st->bindValue(':gender', $gender);
}
$st->bindValue(':lim', $limit, PDO::PARAM_INT);
$st->execute();
$sliderProducts = $st->fetchAll();
?>
<style>
@media (max-width: 400px) {
.product-info-section{
padding-left: 10px !important;
padding-top: 10px !important;
}
.product-slide-item {
flex: 0 0 50vw;
max-width: 50vw;
}
.product-slider-section{
padding: 15px !important;
width: 100% !important;
max-width: 90vw !important;
flex: 0 0 90vw !important;
}
.sss1 {
font-size: 14px !important;
margin-bottom: 15px !important;
}
.nav-arrow-button {
width: 26px !important;
height: 26px !important;
display: none; /* Hide arrows on mobile since we have swipe */
}
.fashion-showcase-container{
gap: 0px !important;
flex-direction: column !important;
}
.hero-image-wrapper {
height: 300px !important;
border-radius: 10px 10px 0 0 !important;
}
.product-slider-section{
border-radius: 0 0 10px 10px !important;
}
.slider-progress-container {
margin-top: 20px;
}
.slider-progress-bar {
width: 60%;
margin: 0 auto;
}
.slider-viewport {
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
-ms-overflow-style: none;
cursor: grab;
}
.slider-viewport:active {
cursor: grabbing;
}
.slider-viewport::-webkit-scrollbar {
display: none;
}
.slider-track {
flex-wrap: nowrap !important;
width: max-content !important;
transition: none !important;
}
.slider-progress-fill {
transition: width 0.2s ease !important;
max-width: 100% !important;
}
.slider-header {
margin-bottom: 20px;
}
}
.fashion-showcase-container {
display: flex;
gap: 0;
padding: 0;
max-width: 100%;
margin: 0 auto;
width: 100%;
}
.main-hero-section {
flex: 1;
position: relative;
}
.hero-image-wrapper {
width: 100%;
height: 698px;
overflow: hidden;
position: relative;
border-radius: 10px 0px 0px 0px;
}
.hero-main-image {
width: 100%;
height: 100%;
object-fit: cover;
}
.product-slider-section {
flex: 1;
position: relative;
background-color: #f8f8f8;
padding: 40px;
border-radius: 0px 10px 10px 0px;
}
.slider-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 30px;
}
.slider-title-section {
flex: 1;
}
.collection-label {
font-size: 14px;
color: #666;
margin-bottom: 8px;
text-transform: capitalize;
letter-spacing: 1px;
}
.sss1 {
font-size: 22px;
color: black;
font-weight: 500;
line-height: 1.3;
margin-bottom: 80px;
max-width: 500px;
}
.slider-viewport {
overflow: hidden;
border-radius: 8px;
position: relative;
cursor: grab;
user-select: none;
}
.slider-viewport:active {
cursor: grabbing;
}
.slider-track {
display: flex;
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
gap: 8px;
}
.slider-track.dragging {
transition: none;
}
.product-slide-item {
flex: 0 0 calc(22% - 15px);
position: relative;
cursor: pointer;
transition: all 0.3s ease;
}
.product-image-container {
position: relative;
width: 100%;
height: 220px;
overflow: hidden;
border-radius: 3px;
}
.product-main-image,
.product-hover-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: opacity 0.3s ease;
}
.product-hover-image {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.product-slide-item:hover .product-hover-image {
opacity: 1;
}
.cart-icon-button {
background: white;
border: none;
width: 30px;
height: 30px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
position: absolute;
bottom: 15px;
right: 15px;
opacity: 0;
transform: translateY(20px);
transition: all 0.3s ease;
z-index: 3;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.product-slide-item:hover .cart-icon-button {
opacity: 1;
transform: translateY(0);
}
.cart-icon-svg {
width: 15px;
height: 24px;
stroke: #333;
}
.product-info-section {
padding: 20px;
text-align: left;
}
.product-brand-name {
font-size: 14px;
color: #000;
margin-bottom: 4px;
}
.product-title-text {
font-size: 13px;
color: #666;
margin-bottom: 8px;
font-weight: 400;
}
.product-price-display {
font-size: 14px;
color: #000;
font-weight: 500;
}
.sold-out-badge {
position: absolute;
top: 15px;
right: 15px;
background: white;
padding: 8px 16px;
border-radius: 20px;
font-size: 12px;
color: #666;
z-index: 3;
}
.slider-navigation-controls {
display: flex;
gap: 12px;
}
.nav-arrow-button {
width: 40px;
height: 40px;
border: none;
border-radius: 0;
background: transparent;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
}
.icon {
color: #333;
transition: color 0.3s ease;
}
.nav-arrow-button:hover .icon {
color: #000;
}
.slider-progress-container {
margin-top: 30px;
width: 100%;
}
.slider-progress-bar {
width: 100%;
height: 1px;
background-color: #e5e5e5;
overflow: hidden;
position: relative;
}
.slider-progress-fill {
height: 100%;
background-color: #333;
transition: width 0.3s ease;
width: 0%;
max-width: 25%;
}
@media (max-width: 1024px) {
.product-slide-item {
flex: 0 0 calc(33.333% - 13px);
}
}
@media (max-width: 768px) {
.fashion-showcase-container {
flex-direction: column;
padding: 50px 0 ;
gap: 30px;
}
.brand-logos-section{
padding-bottom: 0px !important;
text-align: left !important;
}
.brand-logos-section h2{
font-size: 24px !important;
}
}
@media (max-width: 400px) {
.insta-highlight-section {
padding: 1px 10px 80px !important;
}
}
</style>
<div class="cf-sm-pl-0 mt-smm-00">
<div class="fashion-showcase-container">
<div class="main-hero-section">
<div class="hero-image-wrapper">
<img src="img/Rectangle_25.jpg" alt="Fashion Model" class="hero-main-image">
</div>
</div>
<div class="product-slider-section">
<div class="slider-header">
<div class="slider-title-section">
<div class="collection-label">New Collection</div>
<h2 class="collection-title sss1">Explore the Latest Trends with Our Newly Unveiled Collection – Style Starts Here</h2>
</div>
<div class="slider-navigation-controls">
<button class="nav-arrow-button" id="prevBtn">
<svg class="icon icon-caret-left" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.3189 8.14033L18 8.14033V9.86559L3.3189 9.86559L10.2284 16.7751L9 18L0 9L9 0L10.2284 1.22488L3.3189 8.14033Z" fill="currentColor"></path>
</svg>
</button>
<button class="nav-arrow-button" id="nextBtn">
<svg class="icon icon-caret-right" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.6811 9.85967H0L0 8.13441H14.6811L7.77157 1.22488L9 0L18 9L9 18L7.77157 16.7751L14.6811 9.85967Z" fill="currentColor"></path>
</svg>
</button>
</div>
</div>
<div class="slider-viewport" id="sliderViewport">
<div class="slider-track" id="sliderTrack">
<?php foreach ($sliderProducts as $row):
$mainImg = !empty($row['PTHUMB']) ? '../Images/Product/' . $row['PTHUMB'] : 'https://via.placeholder.com/600x750?text=No+Image';
$hoverImg = '';
if (!empty($row['PIMG'])) {
$decoded = json_decode($row['PIMG'], true);
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
$hoverImg = !empty($decoded[0]) ? '../Images/Product/' . $decoded[0] : '';
} else {
$parts = array_map('trim', explode(',', $row['PIMG']));
if (!empty($parts[0])) { $hoverImg = '../Images/Product/' . $parts[0]; }
}
}
$brand = $row['CATEGORY'] ?: 'Brand';
$hasOffer = !empty($row['OFFER_ID']) && !empty($row['OFFER_VALID_UNTIL']);
$offerPrice = $hasOffer ? $row['OFFER_PRICE'] : null;
$offerValidUntil = $hasOffer ? $row['OFFER_VALID_UNTIL'] : null;
$displayPrice = $hasOffer ? $offerPrice : $row['PRICE'];
$productUrl = "product_details.php?pid=" . $row['PID'];
?>
<a href="<?php echo $productUrl; ?>" class="product-slide-item" style="text-decoration:none; color:inherit;">
<div style="position: relative">
<div class="product-image-container">
<img src="<?php echo htmlspecialchars($mainImg); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="product-main-image">
<?php if ($hoverImg): ?>
<img src="<?php echo htmlspecialchars($hoverImg); ?>" alt="<?php echo htmlspecialchars($row['PNAME']); ?>" class="product-hover-image">
<?php endif; ?>
<?php if ($hasOffer): ?>
<div class="offer-badge-common obc-final"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20 12V22H4V12M2 7H22V12H2V7ZM12 2C9 2 8 5 8 5H16C16 5 15 2 12 2ZM12 22V7" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg></div>
<?php endif; ?>
</div>
</div>
<div class="product-info-section">
<div class="product-brand-name"><?php echo htmlspecialchars($brand); ?></div>
<div class="product-title-text"><?php echo htmlspecialchars(mb_strimwidth($row['PNAME'], 0, 20, "...")); ?></div>
<?php if ($hasOffer): ?>
<div class="offer-price-row-wrapper" style="display: flex; justify-content: space-between; align-items: start;">
<div class="product-price-display offer-price-common" style="font-size:13px;">₹ <?php echo number_format((float)$displayPrice, 2); ?></div>
<div class="offer-timer-common" data-offer-end="<?php echo $offerValidUntil; ?>">
<i class="fas fa-clock"></i>
<span class="timer-text">Loading...</span>
</div>
</div>
<?php else: ?>
<div class="product-price-display" style="font-size:13px;color:black">₹ <?php echo number_format((float)$displayPrice, 2); ?></div>
<?php endif; ?>
</div>
</a>
<?php endforeach; ?>
</div>
</div>
<div class="slider-progress-container">
<div class="slider-progress-bar">
<div class="slider-progress-fill" id="progressFill" style="width: 0%;"></div>
</div>
</div>
</div>
</div>
</div>