📁 File Manager
Editing:
/home/wedigitalindia/www/mvskpowdercoating.com/product-category.php
<?php require_once __DIR__ . "/data/contact.php"; require_once __DIR__ . "/includes/header.php"; require_once __DIR__ . "/admin/inc/config.php"; /* |-------------------------------------------------------------------------- | HELPER |-------------------------------------------------------------------------- */ function e($value): string { return htmlspecialchars( (string)($value ?? ''), ENT_QUOTES, 'UTF-8' ); } /* |-------------------------------------------------------------------------- | CATEGORY IMAGE URL |-------------------------------------------------------------------------- */ function categoryImageUrl($filename): string { global $site; if (empty($filename)) { return rtrim( $site['base_url'], '/' ) . '/admin/assets/images/products/default.jpg'; } return rtrim( $site['base_url'], '/' ) . '/admin/assets/images/category/' . ltrim( $filename, '/' ); } /* |-------------------------------------------------------------------------- | PRODUCT IMAGE URL |-------------------------------------------------------------------------- */ function productImageUrl($filename): string { global $site; if (empty($filename)) { return rtrim( $site['base_url'], '/' ) . '/admin/assets/images/products/default.jpg'; } return rtrim( $site['base_url'], '/' ) . '/admin/assets/images/products/' . ltrim( $filename, '/' ); } /* |-------------------------------------------------------------------------- | GET CATEGORY SLUG |-------------------------------------------------------------------------- */ $slug = trim( (string)($_GET['slug'] ?? '') ); $product_category = null; $category_products = []; /* |-------------------------------------------------------------------------- | GET CATEGORY |-------------------------------------------------------------------------- */ if ($slug !== '') { $statement = $pdo->prepare(" SELECT id, top_category_name, top_category_slug, short_name, banner, description, features, applications, meta_title, meta_keyword, meta_description FROM tbl_top_category WHERE top_category_slug = ? AND status = 1 LIMIT 1 "); $statement->execute([ $slug ]); $product_category = $statement->fetch( PDO::FETCH_ASSOC ); } /* |-------------------------------------------------------------------------- | DECODE CATEGORY FEATURES |-------------------------------------------------------------------------- */ $category_features = []; if ( $product_category && !empty($product_category['features']) ) { $decoded_features = json_decode( $product_category['features'], true ); if (is_array($decoded_features)) { $category_features = $decoded_features; } } /* |-------------------------------------------------------------------------- | DECODE CATEGORY APPLICATIONS |-------------------------------------------------------------------------- */ $category_applications = []; if ( $product_category && !empty($product_category['applications']) ) { $decoded_applications = json_decode( $product_category['applications'], true ); if (is_array($decoded_applications)) { $category_applications = $decoded_applications; } } /* |-------------------------------------------------------------------------- | CLEAN FEATURES |-------------------------------------------------------------------------- */ $category_features_clean = []; foreach ( $category_features as $feature ) { if (is_array($feature)) { $feature_text = $feature['name'] ?? $feature['title'] ?? $feature['value'] ?? ''; } else { $feature_text = $feature; } $feature_text = trim((string)$feature_text); if ($feature_text !== '') { $category_features_clean[] = $feature_text; } } $category_features = array_values( array_unique( $category_features_clean ) ); /* |-------------------------------------------------------------------------- | CLEAN APPLICATIONS |-------------------------------------------------------------------------- */ $category_applications_clean = []; foreach ( $category_applications as $application ) { if (is_array($application)) { $application_text = $application['name'] ?? $application['title'] ?? $application['value'] ?? ''; } else { $application_text = $application; } $application_text = trim((string)$application_text); if ($application_text !== '') { $category_applications_clean[] = $application_text; } } $category_applications = array_values( array_unique( $category_applications_clean ) ); /* |-------------------------------------------------------------------------- | GET PRODUCTS UNDER CATEGORY |-------------------------------------------------------------------------- */ if ($product_category) { $statement = $pdo->prepare(" SELECT id, top_category_id, product_name, product_slug, short_description, description, content, main_image, gallery, application, brochure, featured, status FROM tbl_service WHERE top_category_id = ? AND status = 1 ORDER BY featured DESC, id DESC "); $statement->execute([ $product_category['id'] ]); $category_products = $statement->fetchAll( PDO::FETCH_ASSOC ); } /* |-------------------------------------------------------------------------- | PAGE TITLE |-------------------------------------------------------------------------- */ if (!$product_category) { http_response_code(404); $page_title = "Product Category Not Found"; } else { $page_title = $product_category['meta_title'] ?: ( $product_category['top_category_name'] ?? 'Product Category' ); } /* |-------------------------------------------------------------------------- | RELATED CATEGORIES |-------------------------------------------------------------------------- */ $related_categories = []; if ($product_category) { $statement = $pdo->prepare(" SELECT id, top_category_name, top_category_slug, short_name, banner FROM tbl_top_category WHERE status = 1 AND id != ? ORDER BY id ASC LIMIT 4 "); $statement->execute([ $product_category['id'] ]); $related_categories = $statement->fetchAll( PDO::FETCH_ASSOC ); } /* |-------------------------------------------------------------------------- | CONTACT BANNER |-------------------------------------------------------------------------- */ $contact_banner = $contact_page['banner_image'] ?? ''; ?> <?php if (!$product_category): ?> <section class="page-hero"> <div class="container-fluid px-lg-5"> <div class="page-hero-inner"> <span class="eyebrow"> Product </span> <h1> Product <span>Not Found</span> </h1> <p> The product category you are looking for could not be found. </p> <div class="breadcrumb-wrap"> <a href="index.php"> Home </a> <i class="bi bi-chevron-right"></i> <a href="products.php"> Products </a> <i class="bi bi-chevron-right"></i> <span> Not Found </span> </div> </div> </div> </section> <section class="product-not-found"> <div class="container"> <div class="product-not-found-inner"> <i class="bi bi-box-seam"></i> <h2> Product Category Not Available </h2> <p> Please return to our product range and select another category. </p> <a href="products.php" class="btn btn-brand"> View Products <i class="bi bi-arrow-right"></i> </a> </div> </div> </section> <?php else: ?> <section class="page-hero product-category-hero" style=" background-image: linear-gradient( 90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.38) 45%, rgba(0,0,0,.12) 80% ), url('<?= $site['base_url'] ?><?= e($contact_banner) ?>'); "> <div class="container-fluid px-lg-5"> <div class="page-hero-inner"> <span class="eyebrow"> Product Category </span> <h1> <?= e( $product_category['top_category_name'] ) ?> </h1> <div class="breadcrumb-wrap"> <a href="<?= $site['base_url'] ?>index.php"> Home </a> <i class="bi bi-chevron-right"></i> <a href="<?= $site['base_url'] ?>products.php"> Products </a> <i class="bi bi-chevron-right"></i> <span> <?= e( $product_category['short_name'] ?: $product_category['top_category_name'] ) ?> </span> </div> </div> </div> </section> <section class="product-category-section"> <div class="container-fluid px-lg-5"> <!-- ===================================================== TOP CONTENT ====================================================== --> <div class="product-category-main"> <!-- ================================================= LEFT IMAGE ================================================== --> <div class="product-category-left"> <div class="product-category-image"> <img src="<?= e( categoryImageUrl( $product_category['banner'] ) ) ?>" alt="<?= e( $product_category['top_category_name'] ) ?>" loading="lazy"> <div class="product-category-image-overlay"></div> <div class="product-category-image-label"> <span> MVSK Industries LLP </span> </div> </div> </div> <!-- ================================================= RIGHT CONTENT ================================================== --> <div class="product-category-content"> <span class="eyebrow"> Our Solution </span> <h2> <?= e( $product_category['top_category_name'] ) ?> </h2> <!-- <div class="section-line"></div> --> <!-- ================================================= CATEGORY DESCRIPTION ================================================== --> <?php if ( !empty($product_category['description']) ): ?> <div class="category-description"> <?= nl2br( e( $product_category['description'] ) ) ?> </div> <?php endif; ?> <!-- ================================================= KEY FEATURES ================================================== --> <?php if ( !empty($category_features) ): ?> <div class="product-category-products product-category-features"> <div class="product-category-products-heading"> <span> Key Features </span> </div> <div class="product-category-items"> <?php foreach ( $category_features as $feature ): ?> <div class="product-category-item"> <span class="product-category-item-name"> <?= e( $feature ) ?> </span> <!-- <i class="bi bi-check2"></i> --> </div> <?php endforeach; ?> </div> </div> <?php endif; ?> <!-- ================================================= AVAILABLE PRODUCTS ================================================== --> <!-- <div class="product-category-products"> <div class="product-category-products-heading"> <span> Available Solutions </span> </div> <div class="product-category-items"> <?php if ( !empty($category_products) ): ?> <?php foreach ( $category_products as $product ): ?> <a href="product.php?slug=<?= urlencode( $product['product_slug'] ) ?>" class="product-category-item" > <span class="product-category-item-name" > <?= e( $product['product_name'] ) ?> </span> <i class="bi bi-arrow-up-right"></i> </a> <?php endforeach; ?> <?php else: ?> <div class="product-category-item"> <span class="product-category-item-name" > No products available. </span> </div> <?php endif; ?> </div> </div> --> <!-- ================================================= BUTTONS ================================================== --> <div class="product-category-actions"> <a href="<?= $site['base_url'] ?>contact" class="btn btn-brand"> Request a Quote <i class="bi bi-arrow-right"></i> </a> <!-- <a href="products.php" class="product-back-link" > <i class="bi bi-arrow-left"></i> All Products </a> --> </div> </div> </div> <!-- ===================================================== FULL WIDTH APPLICATIONS ====================================================== --> <?php if ( !empty($category_applications) ): ?> <div class="product-category-bottom"> <!-- ================================================= AVAILABLE SOLUTIONS ================================================== --> <div class="product-category-products"> <div class="product-category-products-heading"> <span> Available Solutions </span> </div> <div class="product-category-items"> <?php if ( !empty($category_products) ): ?> <?php foreach ( $category_products as $product ): ?> <a href="<?= rtrim($site['base_url'], '/') ?>/products/<?= e($product_category['top_category_slug']) ?>/<?= e($product['product_slug']) ?>" class="product-category-item"> <span class="product-category-item-name"> <?= e( $product['product_name'] ) ?> </span> <i class="bi bi-arrow-up-right"></i> </a> <?php endforeach; ?> <?php else: ?> <div class="product-category-item"> <span class="product-category-item-name"> No products available. </span> </div> <?php endif; ?> </div> </div> <!-- ================================================= APPLICATIONS ================================================== --> <div class="product-category-products"> <div class="product-category-products-heading"> <span> Applications </span> </div> <div class="product-category-items"> <?php foreach ( $category_applications as $application ): ?> <div class="product-category-item"> <span class="product-category-item-name"> <?= e( $application ) ?> </span> <i class="bi bi-arrow-up-right"></i> </div> <?php endforeach; ?> </div> </div> </div> <?php endif; ?> </div> </section> <!-- ========================================================= RELATED CATEGORIES ========================================================= --> <?php if ( !empty($related_categories) ): ?> <section class="related-products-section"> <div class="container-fluid px-lg-5"> <div class="section-heading"> <span class="eyebrow"> Explore More </span> <h2> Related Categories </h2> <div class="section-line"></div> </div> <div class="related-products-grid"> <?php foreach ( $related_categories as $related ): ?> <a href="<?= $site['base_url'] ?>products/<?= urlencode( $related['top_category_slug'] ) ?>" class="related-product"> <div class="related-product-image"> <img src="<?= e( categoryImageUrl( $related['banner'] ) ) ?>" alt="<?= e( $related['top_category_name'] ) ?>" loading="lazy"> </div> <div class="related-product-content"> <h3> <?= e( $related['top_category_name'] ) ?> </h3> <i class="bi bi-arrow-up-right"></i> </div> </a> <?php endforeach; ?> </div> <div class="explore-products-footer"> <a href="products.php" class="text-link"> View All Products <i class="bi bi-arrow-right"></i> </a> </div> </div> </section> <?php endif; ?> <style> /* ========================================================= PRODUCT CATEGORY — PREMIUM UI RESPONSIVE + NO ARROWS ========================================================= */ /* ========================================================= BREADCRUMB ========================================================= */ .breadcrumb-wrap a{ color:var(--brand); transition:.25s ease } .breadcrumb-wrap a:hover{ color:var(--brand) } .breadcrumb-wrap i{ font-size:14px; color:var(--brand) } .breadcrumb-wrap span{ color:#fff } /* ========================================================= PRODUCT CATEGORY MAIN ========================================================= */ .product-category-section{ padding:100px 0; background:#fff } .product-category-main{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:70px; align-items:start } .product-category-left, .product-category-content{ width:100%; min-width:0 } /* ========================================================= CATEGORY IMAGE ========================================================= */ .product-category-image{ position:relative; width:100%; overflow:hidden; border-radius:14px; background:#f4f5f6; box-shadow:0 18px 45px rgba(0,0,0,.10) } .product-category-image::before{ content:""; position:absolute; inset:14px; z-index:2; border:1px solid rgba(255,255,255,.28); border-radius:9px; pointer-events:none; transition:.4s ease } .product-category-image:hover::before{ inset:10px; border-color:rgba(255,255,255,.5) } .product-category-image img{ display:block; width:100%; height:560px; object-fit:cover; transition:transform .8s cubic-bezier(.2,.7,.2,1) } .product-category-image:hover img{ transform:scale(1.045) } .product-category-image-overlay{ position:absolute; inset:0; z-index:1; background: linear-gradient( 180deg, rgba(0,0,0,.02) 35%, rgba(0,0,0,.68) 100% ); pointer-events:none } .product-category-image-label{ position:absolute; left:30px; bottom:28px; z-index:3 } .product-category-image-label span{ display:inline-flex; align-items:center; gap:9px; color:#fff; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:1.8px } .product-category-image-label span::before{ content:""; width:25px; height:2px; background:var(--brand); border-radius:10px } /* ========================================================= CATEGORY CONTENT ========================================================= */ .product-category-content{ padding-top:8px } .product-category-content>.eyebrow{ display:inline-flex; align-items:center; gap:9px; margin-bottom:12px } .product-category-content>.eyebrow::before{ content:""; width:28px; height:2px; background:var(--brand); border-radius:10px } .product-category-content h2{ margin:0; font-family:Montserrat,sans-serif; font-size:36px; line-height:1.15; font-weight:700; color:#171717 } .product-category-content>.section-line{ margin:18px 0 } /* ========================================================= DESCRIPTION COLOR KEPT AS ORIGINAL ========================================================= */ .category-description{ margin-top:10px; color:#141414; font-size:16px; line-height:1.85 } .category-description p{ margin-bottom:10px } /* ========================================================= PRODUCT / FEATURE BLOCK ========================================================= */ .product-category-products{ margin-top:25px } .product-category-products-heading{ display:flex; align-items:center; justify-content:space-between; margin-bottom:15px; padding-bottom:13px; border-bottom:1px solid #ddd } .product-category-products-heading::after{ content:""; width:45px; height:2px; margin-left:auto; background:var(--brand); border-radius:10px } .product-category-products-heading span{ font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:1.4px; color:#222 } .product-category-items{ display:flex; flex-direction:column; gap:7px } /* ========================================================= ITEM CARDS ========================================================= */ .product-category-item{ position:relative; display:flex; align-items:center; justify-content:space-between; min-height:52px; margin:0; padding:8px 12px; overflow:hidden; background:#f7f8fa; border:1px solid transparent; border-radius:6px; color:#333; box-shadow:0 5px 18px rgba(0,0,0,.045); text-decoration:none; transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease, padding .3s ease, background .3s ease } .product-category-item::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--brand); transform:scaleY(0); transform-origin:center; transition:.3s ease } .product-category-item:hover{ color:#d71963; padding-left:20px; background:#fff; border-color:rgba(215,25,104,.14); transform:translateY(-2px); box-shadow:0 12px 28px rgba(0,0,0,.09) } .product-category-item:hover::before{ transform:scaleY(1) } .product-category-item-name{ flex:1; min-width:0; font-size:15px; font-weight:500; line-height:1.45 } /* Remove all item arrows */ .product-category-item i{ display:none!important } /* ========================================================= KEY FEATURES ========================================================= */ .product-category-features{ margin-top:28px } .product-category-features .product-category-item{ background:#fafafa } /* ========================================================= BOTTOM SECTION ========================================================= */ .product-category-bottom{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:60px; width:100%; margin-top:65px; padding-top:50px; border-top:1px solid #e6e6e6 } .product-category-bottom .product-category-products{ width:100%; min-width:0; margin-top:0 } .product-category-bottom .product-category-products-heading{ margin-bottom:16px } .product-category-bottom .product-category-items{ width:100% } .product-category-bottom .product-category-item{ width:100% } /* ========================================================= APPLICATION CARDS ========================================================= */ .product-category-bottom .product-category-products:nth-child(2) .product-category-items{ display:grid; grid-template-columns:1fr 1fr; gap:12px } .product-category-bottom .product-category-products:nth-child(2) .product-category-item{ display:flex; align-items:center; justify-content:space-between; min-height:65px; margin:0; padding:15px 17px; background:#f7f8fa; border:none; border-radius:6px } /* ========================================================= ACTIONS ========================================================= */ .product-category-actions{ display:flex; align-items:center; gap:25px; margin-top:10px } .product-category-actions .btn{ box-shadow:0 9px 22px rgba(215,25,104,.16); transition:.3s ease } .product-category-actions .btn:hover{ transform:translateY(-2px); box-shadow:0 14px 28px rgba(215,25,104,.22) } /* ========================================================= RELATED CATEGORIES ========================================================= */ .related-products-section{ padding:95px 0; background:#f7f7f7 } .related-products-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:22px } .related-product{ position:relative; display:block; overflow:hidden; background:#fff; border:1px solid #e7e7e7; border-radius:10px; text-decoration:none; color:#222; transition: transform .4s ease, box-shadow .4s ease, border-color .4s ease } .related-product:hover{ color:#222; transform:translateY(-7px); border-color:rgba(215,25,104,.2); box-shadow:0 18px 40px rgba(0,0,0,.10) } .related-product-image{ position:relative; display:block; width:100%; height:220px; overflow:hidden; background:#f3f4f5 } .related-product-image::after{ content:""; position:absolute; inset:0; background: linear-gradient( 180deg, transparent 55%, rgba(0,0,0,.28) ); pointer-events:none } .related-product-image img{ width:100%; height:100%; object-fit:cover; display:block; transition:transform .7s ease } .related-product:hover .related-product-image img{ transform:scale(1.07) } .related-product-content{ position:relative; display:flex; align-items:center; min-height:82px; padding:20px } .related-product-content h3{ margin:0; font-family:Montserrat,sans-serif; font-size:16px; line-height:1.4; font-weight:700; color:#222 } /* Remove related card arrows */ .related-product-content i{ display:none!important } /* ========================================================= VIEW ALL ========================================================= */ .explore-products-footer{ text-align:center; margin-top:45px } .explore-products-footer .text-link{ display:inline-flex; align-items:center; gap:9px; color:#222; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:1px; text-decoration:none; transition:.3s ease } .explore-products-footer .text-link:hover{ color:var(--brand) } .explore-products-footer .text-link i{ display:none!important } /* ========================================================= NOT FOUND ========================================================= */ .product-not-found{ padding:100px 0; background:#fff } .product-not-found-inner{ text-align:center; max-width:600px; margin:auto } .product-not-found-inner>i{ display:flex; align-items:center; justify-content:center; width:72px; height:72px; margin:0 auto 22px; border:1px solid #eee; border-radius:50%; color:var(--brand); font-size:28px } .product-not-found-inner h2{ margin-bottom:15px } .product-not-found-inner p{ color:#666; margin-bottom:30px } /* ========================================================= LARGE TABLET ========================================================= */ @media(max-width:1199px){ .product-category-main{ gap:50px } .product-category-image img{ height:520px } .related-products-grid{ grid-template-columns:repeat(2,1fr) } } /* ========================================================= TABLET ========================================================= */ @media(max-width:991px){ .product-category-section{ padding:80px 0 } .product-category-main{ grid-template-columns:1fr; gap:45px } .product-category-image img{ height:460px } .product-category-content{ padding-top:0 } .product-category-content h2{ font-size:30px } .product-category-bottom{ grid-template-columns:1fr 1fr; gap:35px; margin-top:50px; padding-top:40px } .related-products-section{ padding:80px 0 } } /* ========================================================= MOBILE ========================================================= */ @media(max-width:767px){ .product-category-section{ padding:65px 0 } .product-category-image{ border-radius:9px } .product-category-image img{ height:390px } .product-category-image::before{ inset:9px } .product-category-image-label{ left:22px; bottom:22px } .product-category-image-label span{ font-size:10px } .product-category-content h2{ font-size:27px } .category-description{ font-size:14px; line-height:1.8 } .product-category-bottom{ grid-template-columns:1fr; gap:35px; margin-top:45px; padding-top:35px } .product-category-bottom .product-category-products:nth-child(2) .product-category-items{ grid-template-columns:1fr } .product-category-actions{ align-items:flex-start; flex-direction:column; gap:18px } .related-products-section{ padding:70px 0 } .related-products-grid{ grid-template-columns:1fr; gap:18px } .related-product-image{ height:230px } } /* ========================================================= SMALL MOBILE ========================================================= */ @media(max-width:575px){ .product-category-section{ padding:55px 0 } .product-category-image img{ height:330px } .product-category-image-label{ left:18px; bottom:18px } .product-category-content h2{ font-size:25px } .category-description{ font-size:13px; line-height:1.8 } .product-category-products{ margin-top:22px } .product-category-products-heading{ padding-bottom:11px } .product-category-products-heading span{ font-size:11px } .product-category-item{ min-height:50px; padding:11px 13px } .product-category-item-name{ font-size:13px } .product-category-bottom{ gap:28px; margin-top:38px; padding-top:30px } .related-products-section{ padding:60px 0 } .related-product-content{ min-height:72px; padding:17px } .related-product-content h3{ font-size:14px } .related-product-image{ height:210px } .product-not-found{ padding:70px 0 } .product-not-found-inner h2{ font-size:24px } } /* ========================================================= EXTRA SMALL ========================================================= */ @media(max-width:400px){ .product-category-image img{ height:290px } .product-category-content h2{ font-size:23px } .product-category-item-name{ font-size:12px } .related-product-image{ height:190px } } /* ========================================================= MOBILE PRODUCT CATEGORY ORDER Banner → Content → Image → Key Features → Other Sections ========================================================= */ @media (max-width: 767px) { /* Make main section a flexible ordered layout */ .product-category-main { display: flex !important; flex-direction: column !important; gap: 0 !important; } /* Allow content children to participate in main order */ .product-category-content { display: contents !important; } /* OUR SOLUTION */ .product-category-content > .eyebrow { order: 1; } /* CATEGORY TITLE */ .product-category-content > h2 { order: 2; margin-bottom: 15px; } /* DESCRIPTION */ .product-category-content > .category-description { order: 3; margin-bottom: 25px; } /* IMAGE */ .product-category-left { order: 4; width: 100%; margin-bottom: 30px; } /* KEY FEATURES */ .product-category-content > .product-category-features { order: 5; width: 100%; margin-top: 0; margin-bottom: 25px; } /* BUTTON / OTHER CONTENT */ .product-category-content > .product-category-actions { order: 6; width: 100%; } } </style> <?php endif; ?> <?php require_once __DIR__ . "/includes/footer.php"; ?>
Save
Cancel