{{-- Shop archive — rendered for is_shop() and every product taxonomy (product_cat, product_tag, etc.) via woocommerce/archive-product.php. Layout: hero + toolbar at full width, then a two-column body with the filter sidebar on the left and WC's product grid on the right. On mobile the sidebar is hidden and a "Filtriraj" button in the toolbar reveals it as a slide-in drawer (see app.js + .shop-filters CSS). --}} @extends('layouts.app') @section('content') @php $shopId = function_exists('wc_get_page_id') ? wc_get_page_id('shop') : 0; $heroImg = null; if (is_product_taxonomy()) { $term = get_queried_object(); if ($term && function_exists('get_term_meta')) { $thumbId = (int) get_term_meta($term->term_id, 'thumbnail_id', true); if ($thumbId) { $heroImg = wp_get_attachment_image_url($thumbId, 'eg-hero'); } } } elseif (is_shop() && $shopId > 0 && has_post_thumbnail($shopId)) { $heroImg = get_the_post_thumbnail_url($shopId, 'eg-hero'); } $heroEyebrow = is_product_category() ? __('Kategorija', 'elit-gastro') : (is_product_tag() ? __('Oznaka', 'elit-gastro') : __('Katalog', 'elit-gastro')); // WC's woocommerce_page_title() returns HTML-entity-encoded text on the // search results variant (e.g. `Search results: “foo”`). // Decoding to UTF-8 here lets `{{ … }}` render the curly quotes literally // instead of escaping `&` to `&` and printing the entity source. $heroTitle = is_shop() ? woocommerce_page_title(false) : single_term_title('', false); $heroTitle = html_entity_decode((string) $heroTitle, ENT_QUOTES | ENT_HTML5, 'UTF-8'); // Term description renders BELOW the products grid (see
// further down) — this gives the products primacy on the page while keeping // SEO-relevant intro copy on the archive. $termCopy = is_product_taxonomy() ? trim((string) term_description()) : ''; @endphp
@if ($heroImg) @endif
{{ $heroEyebrow }}

{{ $heroTitle }}

@php // Filter sidebar visibility is editor-controlled via the Customizer // (Trgovina → "Prikaži filtere sa strane"). Default is OFF so the // products grid claims the full row width (6 columns desktop). When // ON, layout collapses to sidebar (300px) + main (1fr) and the toolbar // exposes the mobile "Filtriraj" button. $showFilters = (bool) get_theme_mod('eg_shop_filters', false); @endphp {{-- Shop toolbar removed — the header's site-wide search overlay covers the search use case and the filter sidebar (when enabled via Customizer) is rendered directly inside the shop-page section below. When filters are ON, the mobile "Filtriraj" trigger lives on the sidebar's own header. --}}
@if ($showFilters) {{-- Filter sidebar (desktop) / slide-in drawer (mobile) --}} @include('partials.shop-filters') @endif {{-- Products grid (WC native output) --}}
@php(woocommerce_content())
@if (! empty($termCopy)) {{-- Term descriptions are editable by users with manage_categories cap and are NOT KSES-filtered by core on save — pass through wp_kses_post() so a contributor-level editor can't slip