@php use Botble\Base\Facades\BaseHelper; /** * Sticky header — slides in on scroll past threshold (consumed by main.js). * * Mirrors the active `header_style`'s TOP row so the sticky state visually * matches the demo's behavior (where scrolling hides only the bottom-row * mega-menu while the top row remains pinned). * * For `header-s8 has-by-category` (furniture), `header-s3 has-by-category` * (electronics), and `header-s6 has-by-category` (default) we render the * logo + Browse-by-Category pill + inline search + nav-icon-list pattern. * Other styles fall back to the legacy nav-LEFT + logo-CENTER + actions-RIGHT * compact layout. */ $stickyHeaderStyle = theme_option('header_style', 'style-2'); // Styles that have a `has-by-category` variant: re-use their pill+search layout. $byCategoryStyles = ['style-7', 'style-8', 'style-10']; if (in_array($stickyHeaderStyle, $byCategoryStyles, true)) { $headerCategories = collect(); if (is_plugin_active('ecommerce')) { $headerCategories = app(\Botble\Ecommerce\Repositories\Interfaces\ProductCategoryInterface::class) ->advancedGet([ 'condition' => ['parent_id' => 0, 'status' => 'published'], 'with' => ['slugable', 'activeChildren', 'activeChildren.activeChildren'], 'take' => 10, ]); } $hasEcommerceSearch = is_plugin_active('ecommerce') && \Illuminate\Support\Facades\Route::has('public.products') && \Illuminate\Support\Facades\Route::has('public.ajax.search-products'); $searchAction = $hasEcommerceSearch ? route('public.products') : url('/search'); $ajaxSearchUrl = $hasEcommerceSearch ? route('public.ajax.search-products') : null; } // Inline color overrides from Theme Options → Header. Sticky header always opaque // (no transparent-overlay variant), so apply both bg + fg unconditionally. $stickyStyleParts = []; if (! empty($headerMainBackgroundColor ?? null)) { $stickyStyleParts[] = 'background-color: ' . e($headerMainBackgroundColor); } if (! empty($headerMainTextColor ?? null)) { $stickyStyleParts[] = 'color: ' . e($headerMainTextColor); } $stickyStyleAttr = $stickyStyleParts ? ' style="' . implode('; ', $stickyStyleParts) . '"' : ''; @endphp @if (in_array($stickyHeaderStyle, $byCategoryStyles, true)) {{-- has-by-category sticky variant: logo + Browse + inline search + actions --}}
{{ Theme::getLogoImage(['class' => 'logo-light'], 'logo', 30) }}
@include(Theme::getThemeNamespace('partials.header.browse-by-category'), [ 'categories' => $headerCategories, 'wrapClass' => 'nav-category-wrap style-4 main-action-active d-none d-xl-block', 'btnIconClass' => '', 'nameClass' => 'name-category fw-medium lh-24', ])
$hasEcommerceSearch]) @if ($hasEcommerceSearch) data-ajax-url="{{ $ajaxSearchUrl }}" @endif >
@include(Theme::getThemeNamespace('partials.header.ecommerce-action-buttons'))
@else {{-- Legacy compact sticky for non-by-category headers (nav LEFT + logo CENTER + actions RIGHT) --}}
@include(Theme::getThemeNamespace('partials.header.ecommerce-action-buttons'))
@endif