@php use Botble\Base\Facades\BaseHelper; use Botble\Media\Facades\RvMedia; /** * ecommerce-products style-thumbs-arrival — 2-col "New arrivals" block. * * Mirrors html/home-decor.html §6 (lines 1994-2133): LEFT col-lg-6 with * tag → h3 title → desc → sw-main-thumb swiper of small 88x88 product cards * + RIGHT col-lg-6 with * sw-thumb swiper of large 700x700 product images + prev/next nav arrows. * * Index wires this style with `container_class='sw-thumbs-arrival tf-sw-thumbs'` * + `section_class='section-thumbs-arrival flat-spacing'`. The blade emits the * `
...` content. * * Knobs (PageSeeder attrs): * - tag_text — small uppercase eyebrow (default "New arrivals") * - heading — alias for $shortcode->title (already passed via index) * - description — alias for $shortcode->subtitle (used as the long blurb) * - main_image_size — RvMedia size for the 700x700 right swiper (default false=original) * - thumb_image_size — RvMedia size for 88x88 left thumbs (default thumb) * * Products: $products is the standard collection passed from the parent * ecommerce-products query (source=latest by default). Both swipers iterate * the same product set — LEFT renders compact thumbs, RIGHT renders large images. */ $tagText = trim((string) ($shortcode->tag_text ?? '')) ?: __('New arrivals'); $heading = (string) ($shortcode->title ?? ''); $description = (string) ($shortcode->subtitle ?? ''); $mainImgSize = $shortcode->main_image_size ?? false; // false = original if ($mainImgSize === 'false' || $mainImgSize === '' || $mainImgSize === 'original') { $mainImgSize = false; } $thumbImgSize = trim((string) ($shortcode->thumb_image_size ?? '')) ?: 'thumb'; // Clamp the product set to a single product so the LEFT thumb-swiper and the // RIGHT main-image-swiper always show the same data. Multiple slides drift // out of sync during JS init even with the carousel.js bi-directional // controller wire (theme-js L206-207) — single-slide rendering avoids it. $products = collect($products)->take(1)->values(); @endphp
{{-- LEFT: tag + title + desc + thumbs swiper (small 88x88 product cards) --}}
@if ($tagText !== '')

{!! BaseHelper::clean($tagText) !!}

@endif @if ($heading !== '')

{!! BaseHelper::clean($heading) !!}

@endif @if ($description !== '')

{!! BaseHelper::clean($description) !!}

@endif
@foreach ($products as $product) @php $priceDisplay = format_price($product->front_sale_price_with_taxes ?? $product->sale_price ?? $product->price); @endphp
{!! RvMedia::image($product->image ?? null, $product->name, $thumbImgSize, false, ['width' => 88, 'height' => 88, 'loading' => 'lazy']) !!}
@endforeach
{{-- RIGHT: large 700x700 main product images swiper with prev/next arrows --}}
@foreach ($products as $product)
{!! RvMedia::image($product->image ?? null, $product->name, $mainImgSize, false, ['width' => 700, 'height' => 700, 'loading' => 'lazy']) !!}
@endforeach