@php use Botble\Ecommerce\Facades\EcommerceHelper; use Botble\Media\Facades\RvMedia; use Botble\Theme\Facades\Theme; // $productImages is provided by plugins/ecommerce HandleFrontPages — it // resolves the active variation from URL params (?color=…&size=…) and // returns that variation's images. Fall back to the parent product's // images when no variation matches or the controller didn't pass it. $images = ($productImages ?? null) ?: ($product->images ?: [$product->image]); // Plugin's $product->video accessor returns array of {url, provider, thumbnail, video_id?}. // Filter to only entries with a usable URL so the loop never renders empty slides. $videos = collect($product->video ?? []) ->filter(fn ($v) => is_array($v) && ! empty($v['url'] ?? null)) ->values() ->all(); $hasVideo = ! empty($videos); $videoProviders = array_unique(array_map(fn ($v) => $v['provider'] ?? 'iframe', $videos)); $zoomType = $product->zoom_type ?? theme_option('ecommerce_zoom_type', 'inner'); // Lazy-load gallery libs only on product detail pages — keeps homepage/listing // payloads lean. Drift powers the side-pane hover zoom into .tf-zoom-main; // PhotoSwipe powers the click-to-fullscreen lightbox. Theme::asset()->usePath()->add('photoswipe-css', 'css/vendors/photoswipe.css'); Theme::asset()->container('footer')->usePath()->add('drift', 'js/vendors/drift.min.js', attributes: ['defer']); Theme::asset()->container('footer')->usePath()->add('photoswipe', 'js/vendors/photoswipe.umd.min.js', attributes: ['defer']); Theme::asset()->container('footer')->usePath()->add('photoswipe-lightbox', 'js/vendors/photoswipe-lightbox.umd.min.js', attributes: ['defer']); @endphp
{{-- Video thumbnails — show poster image with play overlay. Falls back to first product image when a video has no thumbnail (e.g. uploaded MP4 with no poster). --}} @foreach ($videos as $vIndex => $video) @php $videoThumb = $video['thumbnail'] ?? (! empty($images) ? RvMedia::getImageUrl($images[0]) : null); @endphp
@if ($videoThumb) {{ __('Video') }} @endif
@endforeach @foreach ($images as $index => $image)
{{ __('Image') }}
@endforeach
{{-- Play-overlay fade rules (.bb-product-video-playing) live in assets/sass/component/_inline-migrated.scss. --}} @if ($zoomType === 'inner') @include(Theme::getThemeNamespace('views.ecommerce.includes.product-zoom-inner')) @elseif ($zoomType === 'inner-circle') @include(Theme::getThemeNamespace('views.ecommerce.includes.product-zoom-inner-circle')) @elseif ($zoomType === 'external' || $zoomType === 'lightbox') @include(Theme::getThemeNamespace('views.ecommerce.includes.product-zoom-external')) @endif