@extends('ecommerce::public.shop-layout') @section('title', $product->name . ' - ' . ($settings->site_name ?? 'Store')) @php $hasVariants = $product->has_variants && $product->activeVariations->count() > 0; $attributes = $hasVariants ? $product->getAttributesWithValues() : []; $priceRange = $product->getPriceRange(); $currentStock = $product->getCurrentStock(); $inStock = $hasVariants ? $product->hasAnyVariationInStock() : ($currentStock > 0); // Get cart quantities for this product (key: variation_id or 0 for non-variant) $cart = session('cart', []); $cartQtyMap = []; foreach ($cart as $key => $item) { if (($item['product_id'] ?? null) == $product->id) { $varId = $item['variation_id'] ?? 0; $cartQtyMap[$varId] = $item['qty']; } } @endphp @section('content')
{{-- Breadcrumb --}}
{{-- Left: Gallery --}} {{-- Right: Details --}}
@if($product->category) {{ $product->category->name }} @endif

{{ $product->name }}

{{-- Price --}}
@if($hasVariants && $priceRange['has_range'])
₹{{ number_format($priceRange['min'], 0) }} - ₹{{ number_format($priceRange['max'], 0) }}
@else ₹{{ number_format($product->sale_price, 0) }} @if($product->mrp && $product->mrp > $product->sale_price) ₹{{ number_format($product->mrp, 0) }} {{ $product->getDiscountPercent() }}% OFF @endif @endif

Inclusive of all taxes

{{-- Stock Status --}}
@if(!$inStock)
Out of Stock
@elseif($hasVariants)
Select options to check stock
@elseif($currentStock <= 5)
Only {{ (int)$currentStock }} left - Order soon!
@else
In Stock
@endif
{{-- Variations - Pre-render with PHP disabled classes --}} @if($hasVariants) @php // Build stock map for each attribute value $stockByAttrValue = []; foreach ($product->activeVariations as $var) { $varStock = $var->getCurrentStock(); foreach ($var->attributeValues as $av) { $key = $av->attribute_id . '_' . $av->id; if (!isset($stockByAttrValue[$key])) { $stockByAttrValue[$key] = 0; } $stockByAttrValue[$key] += $varStock; } } @endphp
@foreach($attributes as $attrData)
@if($attrData['is_color']) {{-- Color Swatches --}}
@foreach($attrData['values'] as $val) @php $stockKey = $attrData['attribute']->id . '_' . $val->id; $hasStock = ($stockByAttrValue[$stockKey] ?? 0) > 0; @endphp @endforeach
@else {{-- Size/Other Options --}}
@foreach($attrData['values'] as $val) @php $stockKey = $attrData['attribute']->id . '_' . $val->id; $hasStock = ($stockByAttrValue[$stockKey] ?? 0) > 0; @endphp @endforeach
@endif
@endforeach
@endif {{-- Quantity --}}
Max: {{ min(99, (int)$currentStock) }}
{{-- Cart Info (shows if item already in cart) --}} {{-- Add to Cart --}}
{{-- Share Buttons --}} {{-- Features --}}
Free Delivery
Secure Payment
Easy Returns
{{-- Description --}} @if($product->description)

Description

{!! nl2br(e($product->description)) !!}
@endif
{{-- Related Products --}} @if(isset($relatedProducts) && $relatedProducts->count() > 0) @endif {{-- Reviews Section --}}

Customer Reviews

@if($product->review_count > 0)
{{ $product->average_rating }}
@for($i = 1; $i <= 5; $i++) @endfor
Based on {{ $product->review_count }} review{{ $product->review_count > 1 ? 's' : '' }}
@php $breakdown = $product->getRatingBreakdown(); @endphp @for($i = 5; $i >= 1; $i--)
{{ $i }} ★
{{ $breakdown[$i] }}
@endfor
@endif
{{-- Write Review Section --}}
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @auth @else
Please sign in to write a review
@endauth
{{-- Reviews List --}}
@forelse($product->approvedReviews()->take(10)->get() as $review)
{{ strtoupper(substr($review->reviewer_name, 0, 1)) }}
{{ $review->reviewer_name }} @if($review->is_verified_purchase) ✓ Verified Purchase @endif
@for($i = 1; $i <= 5; $i++) @endfor
@if($review->title)

{{ $review->title }}

@endif

{{ $review->review }}

{{ $review->created_at->setTimezone('Asia/Kolkata')->format('d M Y') }} @if($review->admin_reply)
Store Response:

{{ $review->admin_reply }}

@endif
@empty

No Reviews Yet

Be the first to share your experience with this product!

@endforelse
{{-- Data for JS --}} @endsection @section('styles') @endsection @section('scripts') @endsection