@if(request('category'))
{{ $activeFilters['category'] }}
×
@endif
@if(request('brand'))
Brand: {{ $activeFilters['brand'] ?? ucfirst(request('brand')) }}
×
@endif
@if(request('price_range'))
@php
[$min, $max] = explode('-', request('price_range'));
$priceLabel = '৳' . number_format($min) . ' - ৳' . number_format($max);
@endphp
{{ $priceLabel }}
×
@endif
@if(request('sizes'))
Size: {{ str_replace(',', ', ', request('sizes')) }}
×
@endif
@if(request('colors'))
Color: {{ str_replace(',', ', ', request('colors')) }}
×
@endif
@if(request('sort'))
@php
$sortLabels = [
'latest' => 'Latest',
'oldest' => 'Oldest',
'price_low' => 'Price: Low to High',
'price_high' => 'Price: High to Low',
'name_asc' => 'Name: A to Z',
'name_desc' => 'Name: Z to A'
];
@endphp
{{ $sortLabels[request('sort')] ?? 'Sort' }}
×
@endif
@if(request()->hasAny(['category', 'brand', 'price_range', 'sizes', 'colors', 'sort']))
Clear All
@endif
@forelse($products as $product)
-
-
-
@php
$defaultInStock = ($product->relationLoaded('variations')
? (int)optional($product->variations->first())->in_stock > 0
: (int)($product->variations()->where('default', true)->value('in_stock') ?? 0) > 0);
$variantsCount = $product->variants_count ?? $product->variations()->count();
$inStockCount = $product->in_stock_variants_count ?? $product->variations()->where('in_stock', '>', 0)->count();
$allOut = ($inStockCount === 0);
$defaultOut = !$defaultInStock;
@endphp
@if($variantsCount > 1 && $defaultOut && !$allOut)
Open
@elseif(($variantsCount === 1 && $defaultOut) || ($variantsCount > 1 && $allOut))
Out of stock
@else
Add to Cart
@endif
@php $avg = $product->average_rating ?? ($product->averageRating ?? 0); @endphp
@empty
No products found
Try adjusting your filters or search criteria
@endforelse
{{ $products->links('partial.pagination') }}