@php use Botble\Base\Facades\BaseHelper; use Botble\Media\Facades\RvMedia; /** * Full product-detail panel — mirrors html/home-sport.html §8 "Banner Product * Single" (lines 2498-2713): `banner-product-single-v2` with a LEFT thumbnail * gallery (`product-thumbs-slider style-row row_left`, vertical thumbs synced * to a main swiper) + RIGHT info column (category tag, name, rating + sold + * SKU meta row, price + old + sale badge, description, live-viewing line, * quantity stepper, Add To Cart + Buy It Now, Compare/Ask/Size-Guide/Share * extra links, View All Details). * * Distinct from `style-2-detail` (the slim HomePetCare panel) — registered as * a separate style so neither variant regresses the other. * * Shortcode attributes (all optional, safe fallbacks): * product_id required — resolved by the parent index partial * detail_tag category tag (default: product's first category, else "Shop") * reviews_count rating badge count (0 = hide the rating block) * urgency_text "18 sold in last 32 hours" — empty = hide * viewing_count live-viewing count (0 = hide the row) * * @var \Botble\Shortcode\Compilers\Shortcode $shortcode * @var \Botble\Ecommerce\Models\Product|null $product */ $detailTag = trim((string) ($shortcode->detail_tag ?? '')); if ($detailTag === '' && $product) { $detailTag = (string) ($product->categories?->first()?->name ?? __('Shop')); } $reviewsCount = (int) ($shortcode->reviews_count ?? 0); $urgencyText = trim((string) ($shortcode->urgency_text ?? '')); $viewingCount = (int) ($shortcode->viewing_count ?? 0); // Gallery images — fall back to the single main image when no gallery is set. $galleryImages = []; if ($product) { $galleryImages = collect($product->images ?? []) ->filter(fn ($img) => is_string($img) && trim($img) !== '') ->values() ->all(); if (empty($galleryImages) && $product->image) { $galleryImages = [$product->image]; } } $isOnSale = $product && $product->front_sale_price !== null && $product->price > 0 && (float) $product->front_sale_price < (float) $product->price; $salePercent = $isOnSale ? (int) round((1 - ((float) $product->front_sale_price / (float) $product->price)) * 100) : 0; $currentPrice = $product ? ($product->front_sale_price_with_taxes ?? $product->front_sale_price ?? $product->price) : 0; @endphp @if ($product) @endif