@php use Botble\Base\Facades\BaseHelper; use Botble\Media\Facades\RvMedia; // Featured product = first in the curated list. Drives the LEFT info card and // CENTER image when present. Static shortcode attributes override product data // for demo presets that need exact HTML-reference content (e.g. HomeJewelry's // "Diamond Floral Pendant" hero with 134 reviews / $399 / SKU 53453412 — none // of which exist on real seeded products). $featured = $products->first(); $featuredCategory = trim((string) ($shortcode->featured_category ?? '')) ?: (optional($featured?->categories?->first())->name ?? __('Featured')); $featuredName = trim((string) ($shortcode->featured_name ?? '')) ?: ($featured->name ?? ''); $featuredSku = trim((string) ($shortcode->featured_sku ?? '')) ?: ($featured->sku ?? ''); $featuredDescription = trim((string) ($shortcode->featured_description ?? '')) ?: ($featured?->description ?? ''); $featuredUrl = trim((string) ($shortcode->featured_url ?? '')) ?: ($featured->url ?? '#'); $reviewsCount = (int) ($shortcode->featured_reviews ?? $featured?->reviews_count ?? 134); $soldQuantity = (int) ($shortcode->featured_sold ?? 18); $viewingQuantity = (int) ($shortcode->featured_viewing ?? 28); $featuredPriceRaw = $shortcode->featured_price ?? null; $featuredOldPriceRaw = $shortcode->featured_old_price ?? null; $hasOverridePrice = $featuredPriceRaw !== null; if ($hasOverridePrice) { $featuredPrice = is_numeric($featuredPriceRaw) ? format_price((float) $featuredPriceRaw) : $featuredPriceRaw; $featuredOldPrice = $featuredOldPriceRaw === null ? null : (is_numeric($featuredOldPriceRaw) ? format_price((float) $featuredOldPriceRaw) : $featuredOldPriceRaw); // Explicit sale-percent override wins so demo presets can match HTML's // displayed badge value when it differs from the price arithmetic. if (! empty($shortcode->featured_sale_percent ?? '')) { $salePercent = (int) $shortcode->featured_sale_percent; } elseif ($featuredOldPriceRaw && is_numeric($featuredPriceRaw) && is_numeric($featuredOldPriceRaw)) { $salePercent = (int) round(100 - ((float) $featuredPriceRaw / (float) $featuredOldPriceRaw * 100)); } else { $salePercent = 0; } } else { $hasSale = $featured && ! empty($featured->sale_price) && $featured->sale_price < $featured->price; $featuredPrice = $featured ? format_price($featured->front_sale_price_with_taxes ?? $featured->price) : ''; $featuredOldPrice = $hasSale ? format_price($featured->price) : null; $salePercent = $hasSale ? round(100 - ($featured->sale_price / $featured->price * 100)) : null; } $soldText = __(':n sold in last 32 hours', ['n' => $soldQuantity]); $viewingText = __(':n people are viewing this right now', ['n' => $viewingQuantity]); $cartLabel = $featuredPrice ? __('Add To Cart - :price', ['price' => $featuredPrice]) : __('Add To Cart'); // CENTER image: explicit `featured_image` attr OR product's main image. $centerImage = $shortcode->featured_image ?? ($featured->image ?? $shortcode->main_image ?? null); // RIGHT image: lifestyle photo from `main_image` (or fallback to center if missing). $rightImage = $shortcode->main_image ?? $centerImage; @endphp {{-- 3-column featured-product hero. Mirrors html/home-jewelry.html banner-product-single style-5: full PDP info card LEFT, main product image CENTER, lifestyle image RIGHT (lifestyle hidden below xxl per demo). Three flex children share equal basis. --}}
@if (! empty($shortcode->heading ?? '') || ! empty($shortcode->subheading ?? ''))
@if (! empty($shortcode->heading ?? ''))

{!! BaseHelper::clean($shortcode->heading) !!}

@endif @if (! empty($shortcode->subheading ?? ''))

{!! BaseHelper::clean($shortcode->subheading) !!}

@endif
@endif