@extends('layouts.user') @section('content')

Products

Filter Products
Product Categories
Product Subcategories
Price
@php $minPrice = $products->min('sale_price') ?? 0; $maxPrice = $products->max('sale_price') ?? 500; @endphp
Min price
{{ $minPrice }}
Max price
{{ $maxPrice }}
Size
@php $sizes = $variants->where('variable_name', 'Size') ->pluck('variable_value') ->unique(); @endphp @foreach($sizes as $size) {{ $size }} @endforeach
Colors
@php $colors = $variants->where('variable_name', 'Color') ->pluck('variable_value') ->unique(); $colorClasses = [ 'Pink' => 'bg-light-pink-2', 'Red' => 'bg-red', 'Beige' => 'bg-beige-2', 'Orange' => 'bg-orange-2', 'Green' => 'bg-light-green', 'Black' => 'bg-main', 'White' => 'bg-white line-black', 'Purple' => 'bg-purple-3', 'Grey' => 'bg-grey', 'Light Blue' => 'bg-light-blue-5', 'Dark Blue' => 'bg-dark-blue', ]; @endphp @foreach($colors as $color)
{{ $color }}
@endforeach
Availability
input('availability') === 'in-stock' ? 'checked' : '' }}>
input('availability') === 'out-of-stock' ? 'checked' : '' }}>
input('availability') ? 'checked' : '' }}>
Filters

Shop sale items only

Sort by:

{{ request()->input('sort', 'Best selling') }}
@if(request()->has('brand') || request()->has('category') || request()->has('availability')) @foreach(request()->input('brand', []) as $brand) {{ ucfirst($brand) }} @endforeach @foreach(request()->input('category', []) as $catId) @php $category = $categories->find($catId); @endphp @if($category) {{ $category->category_name }} @endif @endforeach @if(request()->input('availability') === 'in-stock') In Stock @elseif(request()->input('availability') === 'out-of-stock') Out of Stock @endif @endif
@foreach($products as $product) @php $variant = $product->variants->first(); $mrp = $variant->mrp ?? $product->product_base_mrp; $price = $variant->sale_price ?? $variant->mrp ?? $product->product_base_price; $discount = $mrp && $price < $mrp ? round((($mrp - $price) / $mrp) * 100) : 0; $productVariants = $variants->where('product_id', $product->product_id); $groupedVariants = $productVariants->groupBy('variable_name'); @endphp
{{ $product->product_name }} @if($variant) {{ $product->product_name }} @endif @if($discount > 0)
-{{ $discount }}%
@endif
{{ $product->product_name }}
@if($mrp && $price < $mrp) ₹{{ number_format($mrp, 2) }} @endif ₹{{ number_format($price, 2) }}

{{ strip_tags($product->description ?? '') }}

@if($groupedVariants->count() > 0) @foreach($groupedVariants as $variableName => $variants) @php $uniqueOptions = $variants->pluck('variable_value')->unique(); @endphp
{{ ucfirst($variableName) }}:
    @if(strtolower($variableName) == 'color') @foreach($uniqueOptions as $option) @php $colorVariant = $variants->where('variable_value', $option)->first(); $isAvailable = $colorVariant && $colorVariant->stock > 0; $colorClasses = [ 'Pink' => 'bg-light-pink-2', 'Red' => 'bg-red', 'Beige' => 'bg-beige-2', 'Orange' => 'bg-orange-2', 'Green' => 'bg-light-green', 'Black' => 'bg-main', 'White' => 'bg-white line-black', 'Purple' => 'bg-purple-3', 'Grey' => 'bg-grey', 'Light Blue' => 'bg-light-blue-5', 'Dark Blue' => 'bg-dark-blue', ]; @endphp
  • first ? 'checked' : '' }} {{ !$isAvailable ? 'disabled' : '' }}>
  • @endforeach @else @foreach($uniqueOptions as $option) @php $optionVariant = $variants->where('variable_value', $option)->first(); $isAvailable = $optionVariant && $optionVariant->stock > 0; @endphp
  • first ? 'checked' : '' }} {{ !$isAvailable ? 'disabled' : '' }}>
  • @endforeach @endif
@endforeach @endif
@csrf
Wishlist
@endforeach
    {!! $products->appends(request()->query())->links('pagination::bootstrap-5') !!}
@endsection