@extends('frontend.layouts.app') @section('title', $product->name . ' - ShopNow') @section('content')
@php $mainImage = $product->image ? asset('storage/'.$product->image) : 'https://via.placeholder.com/300x200?text=No+Product+Image'; // Colors from product_colors $productColors = $product->productColors; // Variants from product_variants $productVariants = $product->variants; // Group images by color for the gallery $imagesByColor = []; foreach($product->productColors as $pc) { foreach($pc->images as $imgRecord) { $imagesByColor[$pc->color_id][] = asset('storage/' . $imgRecord->image); } } // Prepare Variant-Color Stock Data for JS $variantStocks = []; foreach($product->variants as $variant) { $variantStocks[$variant->id] = []; foreach($variant->productVariantColors as $vColor) { $variantStocks[$variant->id][$vColor->productColor->color_id] = $vColor->stock; } } @endphp
{{ optional($product->category)->name }} @if($product->brand) {{ $product->brand->name }} @endif

{{ $product->name }}

@for($i=1; $i<=5; $i++) @endfor
({{ $product->reviews->count() }} Reviews)
Rs. {{ number_format($product->effective_price, 2) }} @if($product->effective_discount > 0) Rs. {{ number_format($product->price, 2) }} -{{ round($product->effective_discount) }}% @endif

@if($productVariants->count() > 0)
@foreach($productVariants->sortByDesc('stock') as $variant) @endforeach
@endif @if($productColors->count() > 0)
@foreach($productColors as $pc) @endforeach
@endif
@if($product->available_qty > 0)
IN STOCK
@else
OUT OF STOCK
@endif
@csrf
@auth @else @endauth
@auth
@csrf
@endauth
Free Shipping

On orders over Rs. 5000

Secure Payment

100% safe checkout

Easy Returns

7-day return policy

24/7 Support

Direct line to help

{!! nl2br(e($product->description)) !!}
@foreach($product->specifications as $spec) @endforeach
{{ $spec->header->name ?? 'Feature' }} {{ $spec->specification }}
@endsection @section('styles') @endsection @section('scripts') @endsection