@auth @else @endauth {{ $wishlistCount }}
@php $items = collect(); $cartCount = 0; $cartTotal = 0; if(auth()->check()) { $cartModel = \App\Models\Cart::where('user_id', auth()->id())->first(); if($cartModel) { $items = $cartModel->items()->with([ 'product.images' => function ($query) { $query->orderBy('sort_order', 'asc')->orderBy('id', 'asc'); } ])->get(); $cartCount = $items->sum('quantity'); $cartTotal = $items->sum(function ($item) { return ((float) $item->product->product_price) * (int) $item->quantity; }); } } @endphp {{ __('messages.my_cart') }} {{ $cartCount }}
{{ __('messages.cart') }} ({{ $cartCount }} {{ __('messages.product') }})
@if($items->count() > 0) @foreach($items as $item) @php $product = $item->product; $firstImage = $product?->images?->first(); @endphp
@if($firstImage) {{ $product->product_name }} @else {{ $product->product_name }} @endif
{{ $product->product_name }}
    @if(!empty($item->selected_variants)) @foreach($item->selected_variants as $key => $value)
  • {{ __('messages.' . $key) }} : {{ __('messages.' . $value) }}
  • @endforeach @endif
{{ $item->quantity }} x {{ number_format((float) $product->final_price, 2, ',', ' ') }} €
@endforeach
{{ __('messages.sub_total') }} @php $cart = \App\Models\Cart::where('user_id', auth()->id())->with('items.product')->first(); @endphp {{ number_format((float) $cart->total, 2, ',', ' ') }} €
@else
{{ __('messages.empty_cart') }}
@endif