{{-- @foreach($variant->images as $image)--}} {{-- --}} {{-- @endforeach--}} @if(!empty($variant->cover_image)) @else @endif
{{ $product->title }}

{{ $variant->getAttributeSummary() }}

@php $hasDiscount = ($variant->discounted_price !== null && $variant->discounted_price > 0 && $variant->discounted_price < ($variant->price ?? $variant->real_price)); @endphp @if($hasDiscount)

Sale Rs.{{ number_format($variant->discounted_price) }} Rs.{{ number_format($variant->price) }}

@else

Rs.{{ number_format($variant->real_price) }}

@endif
@if($is_added_to_cart) Added to cart @else Add to cart @endif
@php $videoUrls = []; $rawVideos = $product->Embedded_videos ?? []; // If JSON string, decode to PHP array if (is_string($rawVideos)) { $trimmed = trim($rawVideos); if ($trimmed !== '' && (str_starts_with($trimmed, '[') || str_starts_with($trimmed, '{'))) { $decoded = json_decode($trimmed, true); if (json_last_error() === JSON_ERROR_NONE) { $rawVideos = $decoded; } } } if (is_array($rawVideos)) { foreach ($rawVideos as $entry) { if (is_string($entry)) { $u = trim($entry); if ($u !== '') { $videoUrls[] = $u; } } elseif (is_array($entry)) { // Handle ['url' => '...'] structure or nested arrays if (isset($entry['url']) && is_string($entry['url'])) { $u = trim($entry['url']); if ($u !== '') { $videoUrls[] = $u; } } else { foreach ((array)$entry as $v) { if (is_string($v)) { $u = trim($v); if ($u !== '') { $videoUrls[] = $u; } } elseif (is_array($v) && isset($v['url']) && is_string($v['url'])) { $u = trim($v['url']); if ($u !== '') { $videoUrls[] = $u; } } } } } } } elseif (is_string($rawVideos) && $rawVideos !== '') { // Allow CSV string $parts = array_map('trim', explode(',', $rawVideos)); foreach ($parts as $u) { if ($u !== '') { $videoUrls[] = $u; } } } // De-duplicate $videoUrls = array_values(array_unique($videoUrls)); $modalId = 'videos-modal-' . $product->id; // pass raw, non-unique array to modal (cleaning happens in JS) @endphp @if(count($videoUrls) > 0) @endif
{{-- modal moved to global layout --}} {{-- --}}