@php function renderStarRating($rating, $maxRating = 5) { $fullStar = ""; $halfStar = ""; $emptyStar = ""; $rating = $rating <= $maxRating ? $rating : $maxRating; $fullStarCount = (int) $rating; $halfStarCount = ceil($rating) - $fullStarCount; $emptyStarCount = $maxRating - $fullStarCount - $halfStarCount; $html = str_repeat($fullStar, $fullStarCount); $html .= str_repeat($halfStar, $halfStarCount); $html .= str_repeat($emptyStar, $emptyStarCount); $html = $html; return $html; } @endphp
@if ($items->count() > 0) @if ($checkType != 'list') @foreach ($items as $item)
@if ($item->is_stock()) @else
{{ __('Sold out') }}
@endif @if ($item->previous_price && $item->previous_price != 0)
-{{ PriceHelper::DiscountPercentage($item) }}
@endif
Product

{{ Str::limit($item->name, 38) }}

{!! renderStarRating($item->reviews->avg('rating')) !!}

@if ($item->previous_price != 0) {{ PriceHelper::setPreviousPrice($item->previous_price) }} @endif {{ PriceHelper::grandCurrencyPrice($item) }}

@endforeach @else @foreach ($items as $item)
@if ($item->is_stock()) @else
{{ __('Sold out') }}
@endif @if ($item->previous_price && $item->previous_price != 0)
-{{ PriceHelper::DiscountPercentage($item) }}
@endif Product

{{ Str::limit($item->name, 52) }}

{!! renderStarRating($item->reviews->avg('rating')) !!}

@if ($item->previous_price != 0) {{ PriceHelper::setPreviousPrice($item->previous_price) }} @endif {{ PriceHelper::grandCurrencyPrice($item) }}

{{ Str::limit(strip_tags($item->sort_details), 100) }}

@endforeach @endif @else

{{ __('No Product Found') }}

@endif
{{ $items->links() }}
@section('script') @endsection