@extends('layouts.front.home') @section('title') {{ __('products.cart_title') }} @endsection @section('css') @endsection @section('content')
@include('flash::message') @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @php $vat = 0; $rate = 0.10; $subtotal = 0; @endphp @isset($cart)
@if(count($cart) > 0) @foreach ($cart as $item) @php $product = $item?->product; $cost = $item->quantity * $product->price; $subtotal += $cost; $vat += $cost * $rate; @endphp
@php $img = $product->img ?? ''; if ($img) { if (strpos($img, 'http') === 0) { $imgUrl = $img; } elseif (strpos($img, 'storage/') === 0) { $imgUrl = asset($img); } else { $imgUrl = asset('storage/' . $img); } } else { $imgUrl = asset('front/assets/images/emptyproducts.png'); } @endphp
{{ $product->name }}
{{ $product->name }}
{{ $product->category?->name }}
{{ $product->price }} SAR
{{--
{{ $cost }} SAR
--}}
@endforeach @else
{{ __('products.empty_cart') }}
@endif
@endisset
{{ __('products.payment_details') }}
{{ __('products.subtotal') }}{{ $subtotal }} SAR
{{ __('products.vat') }}{{ $vat }} SAR
{{ __('products.net_total') }}{{ $subtotal + $vat }} SAR
{{ __('products.proceed_to_payment') }}
@endsection @section('script') @endsection