@php $cart = Session::has('cart') ? Session::get('cart') : []; $cart_redeem = Session::has('cart_redeem') ? Session::get('cart_redeem') : []; $total = 0; $option_price = 0; $cartTotal = 0; $user = Auth::user(); if ($user) { $point = App\Models\HistoryPointModel::where('user_id', $user->id) ->where('expired_at', '>', Carbon\Carbon::now()) ->where('type', 'get') ->sum('point'); $point_used = App\Models\HistoryPointModel::where('user_id', $user->id) ->where('expired_at', '>', Carbon\Carbon::now()) ->where('type', 'use') ->sum('point'); $point = $point - $point_used; $point_back = App\Models\Point::where('id', 1)->first(); } else { $point = 0; $point_back = App\Models\Point::where('id', 1)->first(); } $redeem_point = 0; if ($cart_redeem) { foreach ($cart_redeem as $key => $item) { $redeem_point += $item['point']; } } @endphp
{{ __('สินค้า') }}
{{ __('จำนวน') }}
{{ __('ราคารวม') }}
@foreach ($cart as $key => $item) @php $cartTotal += ($item['main_price'] + $total + $item['attribute_price']) * $item['qty']; $checkprofree = PriceHelper::PromotionFree($item['item_id'], $item['qty']); @endphp

{{ Str::limit($item['name'], 45) }}

{{ __('รหัสสินค้า') }}:{{ $item['slug'] }}

{{ PriceHelper::setCurrencyPrice($item['main_price']) }}

@foreach ($item['attribute']['option_name'] as $optionkey => $option_name) {{ $item['attribute']['names'][$optionkey] }}: {{ $option_name }} ({{ PriceHelper::setCurrencyPrice($item['attribute']['option_price'][$optionkey]) }}) @endforeach @if ($checkprofree['status'])
แถม {{ $checkprofree['item']->name }} : {{ $checkprofree['free_item_count'] }} ชิ้น
@endif
@if ($item['item_type'] == 'normal')
@endif

{{ PriceHelper::setCurrencyPrice($item['main_price'] * $item['qty']) }}

@endforeach
@if ($get_free)
{{ __('สินค้าแถม') }}
{{ __('จำนวน') }}
@foreach ($get_free as $key => $value_get_free)

{{ __('โปรโมชั่น') }}:{{ $value_get_free['pro_name'] }}

{{ Str::limit($value_get_free['name'], 45) }}

{{ __('รหัสสินค้า') }}: {{ $value_get_free['slug'] }}

{{ $value_get_free['free_tqy'] }}

@endforeach
@endif
@foreach ($cart_redeem as $key => $item) @php $cartTotal += 0; @endphp

{{ __('รหัสสินค้า') }}:

{{ Str::limit($item['name'], 45) }}

{{ PriceHelper::setCurrencyPrice($item['main_price']) }}

@foreach ($item['attribute']['option_name'] as $optionkey => $option_name) {{ $item['attribute']['names'][$optionkey] }}: {{ $option_name }} ({{ PriceHelper::setCurrencyPrice($item['attribute']['option_price'][$optionkey]) }}) @endforeach

{{ __('กิจกรรมคะแนนแลกสินค้า') }}

@if ($item['item_type'] == 'normal')
@endif

0.00

@endforeach
{{ __('ยอดรวมตะกร้าสินค้า') }}

{{ __('รวม') }}
{{ PriceHelper::setCurrencyPrice($cartTotal - (Session::has('coupon') ? Session::get('coupon')['discount'] : 0)) }}
{{--
{{__('ประมาณค่าขนส่ง')}}
--}} {{--
--}} @if (Auth::user())
{{ __('คูปอง') }}
@csrf
{{-- --}}
@endif
@if ($point_back->status == 'on') @if (floor(($point - $redeem_point) / $point_back->point) > 0)
{{ __('แต้มแทนเงินสด') }}
@csrf
{{-- --}}

@endif @endif
{{ Session::has('usepoint') ? 'ใช้แต้มแทนเงินสด' : '' }}
{{ __('Discount') }}
{{ PriceHelper::setCurrencyPrice(Session::has('usepoint') ? Session::get('usepoint')['sub'] : 0) }}
{{ Session::has('coupon') ? Session::get('coupon')['code']['title'] : '' }}
{{ __('Discount') }}
{{ PriceHelper::setCurrencyPrice(Session::has('coupon') ? Session::get('coupon')['discount'] : 0) }}

{{ __('รวมสุทธิ') }}
{{ PriceHelper::setCurrencyPrice($cartTotal - (Session::has('coupon') ? Session::get('coupon')['discount'] : 0) - (Session::has('usepoint') ? Session::get('usepoint')['sub'] : 0)) }}
{{ __('ยืนยันการสั่งซื้อ') }}
{{--
@foreach ($cart as $key => $item) @php $cartTotal += ($item['main_price'] + $total + $item['attribute_price']) * $item['qty']; @endphp @endforeach
{{ __('Product Name') }} {{ __('Product Price') }} {{ __('Quantity') }} {{ __('Subtotal') }} {{ __('Clear Cart') }}
Product

{{ Str::limit($item['name'], 45) }}

@foreach ($item['attribute']['option_name'] as $optionkey => $option_name) {{ $item['attribute']['names'][$optionkey] }}: {{ $option_name }} ({{ PriceHelper::setCurrencyPrice($item['attribute']['option_price'][$optionkey]) }}) @endforeach
{{ PriceHelper::setCurrencyPrice($item['main_price']) }} @if ($item['item_type'] == 'normal')
@endif
{{ PriceHelper::setCurrencyPrice($item['main_price'] * $item['qty']) }}
--}} {{--
--}}