Viewing file: header_cart.blade.php (4.46 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
@php $grandSubtotal = 0; $qty = 0; $option_price = 0; $user = auth()->user()->id ?? ''; $cartKey = 'cart_' . $user; @endphp @if (Session::has('cart_' . $user)) <div class="aside-header d-flex align-items-center justify-content-between"> <h3 class="mb-0">SHOPPING BAG ({{Session::has('cart_' . $user) ? count(Session::get('cart_' . $user)) : '0'}})</h3> <button class="close-aside-bar open-cart"><i class="far fa-times"></i></button> </div> <div class="aside-body cart-items-list"> <div id="cart-items-section"> @foreach (Session::get('cart_' . $user) as $key => $cart) {{-- {{dd($cart)}} --}} @php $grandSubtotal+= $cart['qty'] * ($cart['main_price'] + $cart['attribute_price']); @endphp <div class="cart-items-list2"> {{-- <div class="entry-delete"><a href="{{route('front.cart.destroy',$key)}}"><i class="icon-x"></i></a></div> --}} <div class="entry-delete"><a href="#" id="add-cart-destroy" data-id="{{ $key }}"><i class="icon-x"></i></a></div> <div class="cart-item d-flex position-relative"> <div class="position-relative"> <a href=""><img src="{{asset('assets/images/'.$cart['photo'])}}" alt="Cart Img" class="cart-item-img-fluid"></a> </div> <div class="cart-item-info flex-grow-1"> <h6>{{ Str::limit($cart['name'], 45) }}</h6> <div class="d-flex align-items-center justify-content-between mt-1"> <div class="position-relative d-flex" style="width: 3.375rem;"> @if ($cart['item_type'] == 'normal') <span class="decreaseQtycart cartsubclick" data-id="{{ $key }}" data-action="decrement" data-target="{{ PriceHelper::GetItemId($key) }}" style="cursor: pointer"><i class="fas fa-minus"></i></span> <input type="number" disabled data-id="{{ $key }}" class=" cartcart-amount qty qty-solo-product border-0 text-center" value="{{ $cart['qty'] }}"> <span class="increaseQtycart cartaddclick" data-id="{{ $key }}" data-target="{{ PriceHelper::GetItemId($key) }}" data-action="increment" data-item="{{ implode(',', $cart['options_id']) }}" style="cursor: pointer"><i class="fas fa-plus"></i></span> <input type="hidden" value="3333" id="current_stock"> @endif </div> <span style="font-size: 1.125rem;">{{PriceHelper::setCurrencyPrice($cart['main_price'])}}</span> </div> <span> @foreach ($cart['attribute'] as $optionkey => $option_name) <span><em>{{ $option_name['name'] }}:</em> <small> ({{ PriceHelper::setCurrencyPrice($option_name['price']) }}) </small> </span> @endforeach </span> </div> </div> </div> @endforeach </div> <!-- Add more items as needed --> </div> <div class="cart-footer"> <hr class="cart-hr"> <div class="d-flex justify-content-between mb-3"> <h6>SUBTOTAL:</h6> <input type="hidden" id="current_sub_total" value="{{PriceHelper::setCurrencyPrice($grandSubtotal)}}"> <span class="sub-total">{{PriceHelper::setCurrencyPrice($grandSubtotal)}}</span> </div> <a href="{{route('front.cart')}}" class="btn btn-light w-100 mb-2 common-btn">View Cart</a> <a href="{{route('front.checkout.billing')}}" class="btn checkout-btn w-100 text-white" style="background-color: #000;">Checkout</a> </div> @else <div class="aside-header d-flex align-items-center justify-content-between"> <h3 class="mb-0">SHOPPING BAG ({{Session::has('cart_' . $user) ? count(Session::get('cart_' . $user)) : '0'}})</h3> <button class="close-aside-bar open-cart"><i class="far fa-times"></i></button> </div> <div class="aside-body cart-items-list"> <div id="cart-items-section "> <div class="emty-cart"> <img src="https://media.tenor.com/8Bt28MKNs7sAAAAj/shopping-cart-ecomm.gif" alt=""> </div> </div> <div class="cart-footer mt-2"> <a href="{{route('front.index')}}" class="btn btn-light w-100 mb-2">Buy Now</a> </div> </div> @endif </div>
|