@extends("general_base") @section("title", "Our Products") @section("style") @endsection @section("content")

Filters

@php $currentCategory = request('category'); @endphp @foreach($categories as $category)
@endforeach

Brands

@foreach($brands as $brand) @if($brand->logo) {{ $brand->title }} @else {{ $brand->title }} @endif @endforeach

Color

@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)
{{ $product->title }}
  • @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
{{ $product->title }}
@php $avg = $product->average_rating ?? ($product->averageRating ?? 0); @endphp
@php $defaultVariation = $product->variations->where('default', true)->first(); @endphp @if($defaultVariation)
৳{{ number_format($defaultVariation->sale_price) }}
@if($defaultVariation->regular_price > $defaultVariation->sale_price)
৳{{ number_format($defaultVariation->regular_price) }}
@endif @endif
@php $icon = 'ri-star-line'; if ($avg >= 0.75) { $icon = 'ri-star-fill'; } elseif ($avg >= 0.25) { $icon = 'ri-star-half-s-fill'; } @endphp {{ number_format($avg,1) }}
@empty

No products found

Try adjusting your filters or search criteria

@endforelse
{{ $products->links('partial.pagination') }}
@endsection @section("script") @endsection