@php $settings = $section->settings ?? []; $title = $settings['title'] ?? 'Featured Products'; $subtitle = $settings['subtitle'] ?? 'Curated selection of our best performing items.'; $limit = $settings['limit'] ?? 8; $columns = $settings['columns'] ?? 4; // Animation Settings $animType = $settings['anim_type'] ?? 'fade-in-up'; $animDuration = $settings['anim_duration'] ?? '0.6s'; $animDelay = $settings['anim_delay'] ?? '0s'; $stagger = $settings['anim_stagger'] ?? true; $hoverAnim = $settings['hover_anim'] ?? 'lift'; $paddingTop = $settings['padding_top'] ?? '48px'; $paddingBottom = $settings['padding_bottom'] ?? '24px'; $bgColor = $settings['bg_color'] ?? 'transparent'; $titleAlignment = $settings['title_alignment'] ?? 'left'; // Default to left for products grid // Mock products for preview // Fetch products with correct scopes $products = \App\Modules\Product\Models\Product::with(['vendor', 'category']) ->published() ->visible() ->when(($settings['source'] ?? 'latest') === 'latest', fn($q) => $q->latest()) ->when(($settings['source'] ?? 'latest') === 'featured', fn($q) => $q->where('is_featured', true)->latest()) ->when(($settings['source'] ?? 'latest') === 'trending', fn($q) => $q->where('is_trending', true)->latest()) ->when(($settings['source'] ?? 'latest') === 'top_sale', fn($q) => $q->where('is_top_sale', true)->latest()) ->when(($settings['source'] ?? 'latest') === 'premium', fn($q) => $q->where('is_premium', true)->latest()) ->when($settings['category_id'] ?? null, fn($q, $id) => $q->where('category_id', $id)) ->limit($limit) ->get(); $gridCols = [ '2' => 'grid-cols-1 sm:grid-cols-2', '3' => 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3', '4' => 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-4', '5' => 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-5', ][$columns] ?? 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-4'; @endphp @php $ptStyle = "padding-top: $paddingTop;"; $pbStyle = "padding-bottom: $paddingBottom;"; $bgStyle = $bgColor !== 'transparent' ? "background-color: $bgColor;" : ''; @endphp

{{ $title }}

{{ $subtitle }}

@foreach ($products as $product) @php $itemDelay = $stagger ? (float)$animDelay + ($loop->index * 0.1) : $animDelay; $hoverClass = $hoverAnim !== 'none' ? 'hover-' . $hoverAnim : ''; @endphp
@include('pages.storefront._product-card', ['product' => $product])
@endforeach