@if(!empty($variant->cover_image)) {{ $product->title }} @else
No Image
@endif
{{ $product->title }}

{{ $variant->getAttributeSummary() }}

@php $hasDiscount = ($variant->discounted_price !== null && $variant->discounted_price > 0 && $variant->discounted_price < ($variant->price ?? $variant->real_price)); $isOutOfStock = ($variant->stock <= 0); $isInactive = ($variant->status != \App\Models\ProductVariant::STATUS_ACTIVE); $canAddToCart = !$isOutOfStock && !$isInactive; @endphp
@if($hasDiscount)
Sale Rs.{{ number_format($variant->discounted_price) }}
Rs.{{ number_format($variant->price) }}
@else
Rs.{{ number_format($variant->real_price) }}
@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)) { 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 !== '') { $parts = array_map('trim', explode(',', $rawVideos)); foreach ($parts as $u) { if ($u !== '') { $videoUrls[] = $u; } } } $videoUrls = array_values(array_unique($videoUrls)); @endphp @if(count($videoUrls) > 0) @endif
@if($isOutOfStock || $isInactive) @if($isOutOfStock) Out of Stock @else Unavailable @endif @elseif($is_added_to_cart) Remove @else Add to cart @endif