@extends('layouts.mobile')
@php
$ogProductImage = $product->getPrimaryImage();
if ($ogProductImage && !filter_var($ogProductImage, FILTER_VALIDATE_URL)) {
$ogProductImage = url($ogProductImage);
}
@endphp
@section('meta_title', $product->name . ' - Buy Online at Gletra Mobile')
@section('meta_description', Str::limit(strip_tags($product->description), 160))
@section('meta_image', $ogProductImage)
@push('scripts')
@endpush
@php
$salePrice = $product->sale_price ?? $product->price;
$inCart = auth()->check() && auth()->user()->cart()->where('product_id', $product->id)->exists();
$cartUrl = route('mobile.cart');
$loginUrl = route('login') . '?redirect=' . urlencode(url()->current());
@endphp
@section('content')
{{-- Primary Image --}}
@if($product->primary_image)
@endif
{{-- Gallery Images --}}
@foreach($product->galleries as $gallery)
@endforeach
{{-- Legacy Images --}}
@if(!$product->primary_image && $product->galleries->count() == 0)
@forelse($product->images as $image)
@empty
@endforelse
@endif
@php
$hasNewGallery = $product->primary_image || $product->galleries->count() > 0;
@endphp
@if($hasNewGallery || $product->images->count() > 1)
@if($product->primary_image)
@endif
@foreach($product->galleries as $gallery)
@php $idx = $product->primary_image ? $loop->iteration : $loop->index; @endphp
@endforeach
@if(!$hasNewGallery)
@foreach($product->images as $image)
@endforeach
@endif
@endif
{{ $product->name }}
@if($product->short_description)
{{ $product->short_description }}
@endif
₹{{ number_format($product->sale_price ?? $product->price, 0) }}
₹{{ number_format($product->price, 0) }}
{{ number_format($product->approvedReviews->avg('rating') ?? 4.2, 1) }}
{{ $product->approvedReviews->count() }} Ratings
@if($product->variants->count() > 0)
@include('partials.product-variant-selector')
@endif
@php
$approvedReviews = $product->approvedReviews;
$photoReviewCount = $approvedReviews->filter(fn($r) => $r->hasPhotos())->count();
$reviewCount = $approvedReviews->count();
@endphp
{{ $product->description ?: 'No detailed description available for this product.' }}
@include('partials.mobile-product-specifications', ['product' => $product])
Ratings & Reviews
{{ $photoReviewCount }} photos
@forelse($approvedReviews as $review)
{{ $review->rating }}
{{ $review->user->name ?? 'Customer' }}
@if($review->review)
{{ $review->review }}
@endif
@if($review->hasPhotos())
@foreach($review->getImageUrls() as $imgUrl)

@endforeach
@endif
{{ $review->created_at?->diffForHumans() }}
@empty
No approved reviews yet.
@endforelse
@php $photoReviews = $approvedReviews->filter(fn($r) => $r->hasPhotos()); @endphp
@forelse($photoReviews as $review)
@foreach($review->getImageUrls() as $imgUrl)

@endforeach
{{ $review->rating }} ★ — {{ $review->user->name ?? 'Customer' }}
@if($review->review)
{{ Str::limit($review->review, 120) }}
@endif
@empty
No photo reviews yet.
@endforelse
@include('partials.product-review-cta', ['compact' => true])