@extends('layouts.user') @section('content')
@php $allVariants = $product->variants; // Get unique variant images $uniqueImages = $allVariants->where('image', '!=', null)->pluck('image')->unique()->toArray(); // Get gallery images from product_gallery column (JSON array) $galleryImages = []; if (!empty($product->product_gallery)) { // Decode the JSON array from product_gallery $galleryImages = json_decode($product->product_gallery, true) ?? []; } // Combine all images: thumbnail + gallery images + variant images $images = array_merge( [$product->product_thumbnail], // Main thumbnail first $galleryImages, // Gallery images $uniqueImages // Variant images ); // Remove any null or empty values and ensure uniqueness $images = array_filter($images); $images = array_unique($images); @endphp @foreach($images as $index => $image) @php $variantForImage = $allVariants->where('image', $image)->first(); $colorForImage = $variantForImage ? ($variantForImage->variable_name == 'Color' ? $variantForImage->variable_value : null) : null; @endphp
{{ $product->product_name }} - Thumbnail {{ $index + 1 }}
@endforeach
{{ strip_tags($product->category->category_name ?? 'Clothing') }}

{{ strip_tags($product->product_name) }}

@for($i = 1; $i <= 5; $i++) @endfor
@php $firstVariant = $product->variants->first(); $salePrice = $firstVariant ? $firstVariant->sale_price : $product->product_base_price; $mrp = $firstVariant ? $firstVariant->mrp : $product->product_base_mrp; $discount = $mrp && $salePrice < $mrp ? round((($mrp - $salePrice) / $mrp) * 100) : 0; @endphp
₹ {{ number_format($salePrice, 2) }}
@if($mrp && $salePrice < $mrp)
₹{{ number_format($mrp, 2) }}
@endif @if($discount > 0)
-{{ $discount }}%
@endif
@php $groupedVariants = $product->variants->groupBy('variable_name'); @endphp @if($groupedVariants->count() > 0)
@foreach($groupedVariants as $variableName => $variants) @php $uniqueOptions = $variants->pluck('variable_value')->unique(); @endphp
{{ ucfirst($variableName) }}: {{ $uniqueOptions->first() ?? '' }}
@if(strtolower($variableName) == 'color') @foreach($uniqueOptions as $option) @php $colorVariant = $variants->where('variable_value', $option)->first(); @endphp first ? 'checked' : '' }}> @endforeach @else @foreach($uniqueOptions as $option) @php $optionVariant = $variants->where('variable_value', $option)->first(); $isAvailable = $optionVariant && $optionVariant->stock > 0; @endphp first ? 'checked' : '' }} {{ !$isAvailable ? 'disabled' : '' }}> @endforeach @endif
@endforeach
@endif
@if($sizeChart) Size Icon Size Guide @endif
@if($sizeChart) @endif
Quantity:
- +

@csrf
Wishlist
@csrf

  • Description
  • Customer Reviews
{{ $product->product_name }}

{{ strip_tags($product->description ?? "Nodding to retro styles, this Hyperbola T-shirt is defined by its off-the-shoulder design.") }}

{{ strip_tags($product->details ?? '') }}

@if(!empty($product->highlights))
PRODUCT HIGHLIGHTS
    @foreach(explode("\n", strip_tags($product->highlights)) as $highlight)
  • {{ $highlight }}
  • @endforeach
@endif
Cancel Review
Write a review
Sort by:
Most Recent
{{-- Review Form --}}
@csrf

Write a review:

@for($i = 5; $i >= 1; $i--) @endfor
Review Title
Review
{{-- Upload Images --}}
{{-- Upload Videos --}}
{{-- Display Approved Reviews --}}

Customer Reviews

@php $approvedReviews = $product->reviews()->where('status', 'approved')->latest()->get(); @endphp @if($approvedReviews->count() > 0) @foreach($approvedReviews as $review)
{{-- Reviewer Avatar / Placeholder --}}
{{ strtoupper(substr($review->customer_name,0,1)) }}
{{-- Review Content --}}
{{ $review->customer_name }}
{{ $review->created_at->format('d M, Y') }}
{{-- Stars --}}
@for($i = 1; $i <= 5; $i++) @endfor
{{-- Review Title --}}
{{ $review->review_title }}
{{-- Review Text --}}

{{ $review->review }}

{{-- Images --}} @if($review->images)
@foreach(json_decode($review->images, true) as $img) @endforeach
@endif {{-- Videos --}} @if($review->videos)
@foreach(json_decode($review->videos, true) as $vid) @endforeach
@endif
@endforeach @else

No reviews yet. Be the first to write one!

@endif
@endsection