@php use Botble\Base\Facades\BaseHelper; use Botble\Ecommerce\Facades\EcommerceHelper; use Botble\Theme\Facades\Theme; $isOutOfStock = $isOutOfStock ?? (method_exists($product, 'isOutOfStock') ? $product->isOutOfStock() : false); $isPreOrder = $isPreOrder ?? (bool) ($product->is_pre_order ?? false); $hasCustomerNote = $hasCustomerNote ?? (bool) ($product->customer_note_enabled ?? false); $hasVolumeDiscount = $hasVolumeDiscount ?? (bool) ($product->enable_volume_discount ?? false); $hasBuyXGetY = $hasBuyXGetY ?? (bool) ($product->enable_buy_x_get_y ?? false); $hasBundleTogether = $hasBundleTogether ?? (bool) ($product->frequently_bought_together ?? false); $flashSale = $flashSale ?? null; $selectedAttrs = $selectedAttrs ?? []; // Quick-view variant: inline social share row replaces the modal-trigger, // and the nested #share modal isn't rendered (Bootstrap doesn't stack modals reliably). $isQuickView = $isQuickView ?? false; $isAffiliate = (bool) ($product->is_affiliate ?? false); $affiliateUrl = $product->external_url ?? null; $stockProgress = (int) ($product->stock_progress ?? 0); @endphp
@if ($product->categories->isNotEmpty())

@foreach ($product->categories as $category) {{ $category->name }}{{ ! $loop->last ? ', ' : '' }} @endforeach

@endif

{{ $product->name }}

@if (EcommerceHelper::isReviewEnabled() && (! EcommerceHelper::hideRatingWhenNoReviews() || $product->reviews_count > 0))
@include(EcommerceHelper::viewPath('includes.rating-star'), ['avg' => $product->reviews_avg]) ({{ (int) $product->reviews_count === 1 ? __(':count review', ['count' => number_format($product->reviews_count)]) : __(':count reviews', ['count' => number_format($product->reviews_count)]) }})
@endif @php $soldCount = (int) ($product->sold_count ?? 0); $soldHours = (int) theme_option('product_sold_window_hours', 32); @endphp @if ($soldCount > 0)
{{ __(':count sold in last :hours hours', ['count' => number_format($soldCount), 'hours' => $soldHours]) }}
@endif @if (! empty($product->sku))
{{ __('SKU:') }} {{ $product->sku }}
@endif
@if ($isPreOrder) @include(Theme::getThemeNamespace('views.ecommerce.includes.product-pre-order'), compact('product')) @endif
@include(EcommerceHelper::viewPath('includes.product-price'), [ 'product' => $product, 'priceWrapperClassName' => '', 'priceClassName' => 'price-on-sale h4 fw-semibold', 'priceOriginalWrapperClassName' => '', 'priceOriginalClassName' => 'cl-text-3 text-decoration-line-through', ])
@if (is_plugin_active('marketplace'))
@include(Theme::getThemeNamespace('views.marketplace.includes.vendor-info'), ['store' => $product->store ?? null])
@endif @if ($product->description)
{!! BaseHelper::clean($product->description) !!}
@endif {{-- Standard Botble hook: plugins (e.g. Loyalty Points) inject after the product description here. Amerce overrides the default product-detail view, so this must be re-declared or the injected content is lost. --}} {!! apply_filters('ecommerce_after_product_description', null, $product) !!} @php $viewersCount = (int) theme_option('product_live_viewers_count', 0); if ($viewersCount <= 0) { $viewersCount = ((int) $product->id * 7) % 50 + 10; } @endphp
{{ __(':count people are viewing this right now', ['count' => $viewersCount]) }}
@if ($stockProgress > 0)
{{ __('Available:') }} {{ (int) ($product->quantity ?? 0) }}
{{ __('Sold:') }} {{ (int) ($product->sold_count ?? 0) }}
@endif @if ($isOutOfStock) {{-- Back-in-stock subscription only matters on out-of-stock products, but the plugin's ECOMMERCE_PRODUCT_DETAIL_EXTRA_HTML hook (below) lives in the in-stock branch. When the Back in Stock plugin is active, hand off to it here so its Display Mode (Modal/Inline) setting is honoured; otherwise fall back to the theme's own notify form. --}} @if (is_plugin_active('ecommerce-back-in-stock')) {!! BaseHelper::clean(apply_filters(ECOMMERCE_PRODUCT_DETAIL_EXTRA_HTML, '', $product)) !!} @else @include(Theme::getThemeNamespace('views.ecommerce.includes.product-out-of-stock'), compact('product')) @endif @else @if ($hasCustomerNote) @include(Theme::getThemeNamespace('views.ecommerce.includes.product-customer-note'), compact('product')) @endif @if ($product->variations->isNotEmpty()) {{-- Helper output is trusted server-rendered markup; do NOT wrap in BaseHelper::clean(), it strips data-target / data-bb-* attrs that change-product-swatches.js relies on to wire the variation AJAX. --}} {!! render_product_swatches($product, ['selected' => $selectedAttrs]) !!} @endif {!! render_product_options($product) !!} @include(Theme::getThemeNamespace('views.ecommerce.includes.product-availability'), compact('product')) @if ($flashSale) @php // Vendor count-down.js (loaded globally as 'countdown') // expects data-timer in seconds and renders the // .countdown__timer > .countdown__item children itself. $countdownSeconds = max(0, $flashSale->end_date->endOfDay()->timestamp - now()->timestamp); @endphp
{{-- Alarm clock SVG (matches html/product-countdown-timer.html demo). .tf-ani-tada triggers the existing tada keyframe. --}}
{{ __('Hurry up offer ends in:') }}
@endif {!! BaseHelper::clean(apply_filters(ECOMMERCE_PRODUCT_DETAIL_EXTRA_HTML, '', $product)) !!} @if (EcommerceHelper::isCartEnabled() && ! $isAffiliate)

{{ __('Quantity:') }}

@include(Theme::getThemeNamespace('views.ecommerce.includes.cart-quantity'), [ 'product' => $product, 'isOutOfStock' => $isOutOfStock, ])
@if (EcommerceHelper::isQuickBuyButtonEnabled()) @endif
@endif @if ($isAffiliate && $affiliateUrl) {{ __('Buy on External Store') }} @endif
@endif