@forelse($products as $key => $value)
{{-- Discount badge --}}
@if($value->old_price && $value->old_price > $value->new_price)
@php
$discount = ((($value->old_price - $value->new_price) * 100) / $value->old_price);
@endphp
{{ number_format($discount, 0) }}%
ছাড়
@endif
@php
$averageRating = $value->reviews->avg('ratting');
$filledStars = floor($averageRating);
$hasHalfStar = $averageRating - $filledStars >= 0.5;
$emptyStars = 5 - $filledStars - ($hasHalfStar ? 1 : 0);
@endphp
@if ($averageRating >= 0 && $averageRating <= 5)
@for ($i = 0; $i < $filledStars; $i++)
@endfor
@if ($hasHalfStar)
@endif
@for ($i = 0; $i < $emptyStars; $i++)
@endfor
@endif
@if($value->old_price)
৳ {{ $value->old_price }}
@endif
৳ {{ $value->new_price }}
{{-- Order and Cart Buttons --}}
@if (!$value->prosizes->isEmpty() || !$value->procolors->isEmpty())
{{-- Variant product – go to detail page --}}
@else
{{-- Simple product --}}
@endif
@empty
No products found in this shop.
@endforelse