@php $resolveTopSellingItem = function($entry) { if (empty($entry)) return null; $it = $entry->item ?? ($entry instanceof \App\Models\User\UserItem ? $entry : null); if (empty($it)) return null; if (empty($it->itemContents) || count($it->itemContents) == 0) { $fallback = \App\Models\User\ItemContent::where('item_id', $it->id)->get(); if ($fallback->isNotEmpty()) { $it->setRelation('itemContents', $fallback); } } return $it; }; @endphp

{{ $userSec->top_selling_product_section_title ?? __('Top Selling') }}

@if (count($top_selling) == 0)
{{ $keywords['NO PRODUCTS FOUND'] ?? __('NO PRODUCTS FOUND') }}
@else
@if (!empty($top_selling)) @for ($k = 0; $k < count($top_selling); $k += 4) @php $item0 = $resolveTopSellingItem($top_selling[$k] ?? null); $item1 = $resolveTopSellingItem($top_selling[$k + 1] ?? null); $item2 = $resolveTopSellingItem($top_selling[$k + 2] ?? null); $item3 = $resolveTopSellingItem($top_selling[$k + 3] ?? null); @endphp @if ($item0 || $item1 || $item2 || $item3)
@php $slotItem = $item0; $slotContent = (!empty($slotItem) && !empty($slotItem->itemContents) && count($slotItem->itemContents) > 0) ? $slotItem->itemContents[0] : null; $slotQty = $top_selling[$k]->quantity ?? 0; @endphp @if ($slotItem && $slotContent && @$slotItem->status == 1)
Product
{{ @$slotContent->category->name ?? '' }}

{{ $slotContent->title }} ({{ $slotQty }})

@if ($shop_settings->item_rating_system == 1)
({{ reviewCount($slotItem->id) }})
@endif @php $flash_info = flashAmountStatus( $slotItem->id, $slotItem->current_price, ); $product_current_price = $flash_info['amount']; $flash_status = $flash_info['status']; @endphp
@if ($flash_status == true) {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($product_current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} @else {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->previous_price)) }} @endif
@if ($shop_settings->catalog_mode != 1) @endif @php $customer_id = Auth::guard('customer')->check() ? Auth::guard('customer')->user()->id : null; $checkWishList = $customer_id ? checkWishList($slotItem->id, $customer_id) : false; @endphp
@endif @php $slotItem = $item1; $slotContent = (!empty($slotItem) && !empty($slotItem->itemContents) && count($slotItem->itemContents) > 0) ? $slotItem->itemContents[0] : null; $slotQty = $top_selling[$k + 1]->quantity ?? 0; @endphp @if ($slotItem && $slotContent && @$slotItem->status == 1)
Product
{{ @$slotContent->category->name ?? '' }}

{{ $slotContent->title }} ({{ $slotQty }})

@if ($shop_settings->item_rating_system == 1)
({{ reviewCount($slotItem->id) }})
@endif @php $flash_info = flashAmountStatus( $slotItem->id, $slotItem->current_price, ); $product_current_price = $flash_info['amount']; $flash_status = $flash_info['status']; @endphp
@if ($flash_status == true) {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($product_current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} @else {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->previous_price)) }} @endif
@if ($shop_settings->catalog_mode != 1) @endif @php $customer_id = Auth::guard('customer')->check() ? Auth::guard('customer')->user()->id : null; $checkWishList = $customer_id ? checkWishList($slotItem->id, $customer_id) : false; @endphp
@endif @php $slotItem = $item2; $slotContent = (!empty($slotItem) && !empty($slotItem->itemContents) && count($slotItem->itemContents) > 0) ? $slotItem->itemContents[0] : null; $slotQty = $top_selling[$k + 2]->quantity ?? 0; @endphp @if ($slotItem && $slotContent && @$slotItem->status == 1)
Product
{{ @$slotContent->category->name ?? '' }}

{{ $slotContent->title }} ({{ $slotQty }})

@if ($shop_settings->item_rating_system == 1)
({{ reviewCount($slotItem->id) }})
@endif @php $flash_info = flashAmountStatus( $slotItem->id, $slotItem->current_price, ); $product_current_price = $flash_info['amount']; $flash_status = $flash_info['status']; @endphp
@if ($flash_status == true) {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($product_current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} @else {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->previous_price)) }} @endif
@if ($shop_settings->catalog_mode != 1) @endif @php $customer_id = Auth::guard('customer')->check() ? Auth::guard('customer')->user()->id : null; $checkWishList = $customer_id ? checkWishList($slotItem->id, $customer_id) : false; @endphp
@endif @php $slotItem = $item3; $slotContent = (!empty($slotItem) && !empty($slotItem->itemContents) && count($slotItem->itemContents) > 0) ? $slotItem->itemContents[0] : null; $slotQty = $top_selling[$k + 3]->quantity ?? 0; @endphp @if ($slotItem && $slotContent && @$slotItem->status == 1)
Product
{{ @$slotContent->category->name ?? '' }}

{{ $slotContent->title }} ({{ $slotQty }})

@if ($shop_settings->item_rating_system == 1)
({{ reviewCount($slotItem->id) }})
@endif @php $flash_info = flashAmountStatus( $slotItem->id, $slotItem->current_price, ); $product_current_price = $flash_info['amount']; $flash_status = $flash_info['status']; @endphp
@if ($flash_status == true) {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($product_current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} @else {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->current_price)) }} {{ symbolPrice($userCurrentCurr->symbol_position, $userCurrentCurr->symbol, currency_converter($slotItem->previous_price)) }} @endif
@if ($shop_settings->catalog_mode != 1) @endif @php $customer_id = Auth::guard('customer')->check() ? Auth::guard('customer')->user()->id : null; $checkWishList = $customer_id ? checkWishList($slotItem->id, $customer_id) : false; @endphp
@endif
@endif @endfor @endif
@endif

{{ $userSec->top_selling_product_section_title ?? __('Top Selling') }}

@for ($skeleton = 1; $skeleton <= 3; $skeleton++)

@endfor