@props(['product', 'mode' => 'grid']) @php $special = false; $today = date('Y-m-d'); if ($product->special_price_from) { if ($product->special_price_from <= $today && $product->special_price_to >= $today) { $special = true; } } $productUrl = route('productByCategory', $product->url_key).'?sku='.$product->sku; // Retrieve image $imageUrl = asset('frontend/assets/images/default.jpg'); if (count($product->images)) { $imageUrl = asset($product->images[0]->image_url); } // Check if new (e.g. created in last 30 days) $isNew = $product->created_at >= \Carbon\Carbon::now()->subDays(30); // Review rating dynamically from reviews table $reviewsCount = $product->reviews_count; $avgRating = $product->avg_rating; $roundedRating = (int) round($avgRating); @endphp
{{ $product->name }} hover-image
    @if($isNew)
  • New
  • @endif @if($special)
  • Sale
  • @endif @if(!($product->inventory && $product->inventory->inventory > 0 && $product->in_stock))
  • Out of stock
  • @endif
@php $inWishlist = false; if(auth('customer')->check()) { if(!isset($GLOBALS['customer_wishlist_ids'])) { $GLOBALS['customer_wishlist_ids'] = \App\Models\WishList::where('customer_id', auth('customer')->id())->pluck('product_id')->toArray(); } $inWishlist = in_array($product->id, $GLOBALS['customer_wishlist_ids']); } @endphp {{ $inWishlist ? 'Remove from Wishlist' : 'Add to Wishlist' }}
@php $brandText = (!empty($product->brand_name->name) && trim($product->brand_name->name) !== '-') ? trim($product->brand_name->name) : '-'; @endphp {{ $brandText }} {{ $product->name }}
@for($i = 1; $i <= 5; $i++)
@endfor
{{ $reviewsCount }} Review(s) 
@php $descText = ''; if (!empty($product->small_description) && !str_contains(strtolower($product->small_description), 'null')) { $descText = \Illuminate\Support\Str::limit(strip_tags($product->small_description), 180); } elseif (!empty($product->description) && !str_contains(strtolower($product->description), 'null')) { $descText = \Illuminate\Support\Str::limit(strip_tags($product->description), 180); } else { $descText = ""; } @endphp

{{ $descText }}

@if($special) ${{ number_format($product->price, 2) }} ${{ number_format($product->special_price, 2) }} @else ${{ number_format($product->price, 2) }} @endif