@php
// Separate color variation images from regular gallery images
$colorVariationImages = $product->images->whereNotNull('color_code')->groupBy('color_code');
$galleryImages = $product->images->whereNull('color_code');
$hasColorVariations = $colorVariationImages->count() > 0;
// Get primary or first image
$primaryImage = $product->images->where('is_primary', true)->first()
?? $product->images->whereNull('color_code')->first()
?? $product->images->first();
@endphp
@if($hasColorVariations)
@endif
Color Variations
@foreach($colorVariationImages as $colorCode => $colorImages)
@php
$firstColorImage = $colorImages->first();
$colorName = $firstColorImage->color_name ?? 'Color';
$stockQty = $firstColorImage->qty ?? 0;
@endphp
{{ $colorName }}
Stock: {{ $stockQty }}
@endforeach
@if($primaryImage)
@if($primaryImage->color_name)
@elseif($product->thumbnail)
@else
@endif
@if($hasColorVariations || $galleryImages->count() > 0)
{{ $primaryImage->color_name }}
Stock: {{ $primaryImage->qty ?? 0 }}
@endif
No Images Available
@foreach($galleryImages as $image)
@if($image->is_primary)
@endif
@endforeach
@foreach($colorVariationImages as $colorCode => $colorImages)
@php
$firstColorImage = $colorImages->first();
$colorName = $firstColorImage->color_name ?? 'Color';
@endphp
@foreach($colorImages as $image)
@endforeach
@endforeach
@endif
{{ $product->name }}
Status: {{ ucfirst($product->status) }}
Stock: {{ ucfirst(str_replace('_', ' ', $product->stock_status)) }}
@if($product->is_featured)
Featured
@endif
@if($product->is_trending)
Trending
@endif
@if($product->is_hot)
Hot
@endif
@if($product->is_sale)
On Sale
@endif
SKU: {{ $product->sku_code }} |
@if($product->short_description)
{{ $product->short_description }}
@endif
{{ number_format($product->price, 2) }}
@if($product->compare_price && $product->compare_price > $product->price)
{{ number_format($product->compare_price, 2) }}
({{ round((($product->compare_price - $product->price) / $product->compare_price) * 100) }}% OFF)
@endif
Cost Price:
{{ number_format($product->cost_price, 2) }}
Product Details
| Category: | {{ $product->category->name }} |
| SubCategory: | {{ $product->childCategory->name }} |
| Sub-Subcategory: | {{ $product->subcategory->name }} |
| Brand: | {{ $product->brand->name }} |
| Seller: | {{ $product->seller->name }} |
Physical Details
| Weight: | {{ number_format($product->weight, 2) }} kg |
| Dimensions: | {{ $product->dimensions }} |
| Created: | {{ $product->created_at->format('d M Y, h:i A') }} |
| Last Updated: | {{ $product->updated_at->format('d M Y, h:i A') }} |