/
home
/
sjslayjy
/
public_html
/
theweavenest
/
resources
/
views
/
front
/
Upload File
HOME
@extends('front.layout_alt') @section('page_title', 'cart') @section('content') <section class="page-header"> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="content"> <h1 class="page-name">Cart</h1> <ol class="breadcrumb"> <li><a href="/">Home</a></li> <li class="active">cart</li> </ol> </div> </div> </div> </div> </section> <div class="page-wrapper"> <div class="cart shopping"> <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="block"> <div class="product-list"> <form method="post"> @if(isset($list[0])) <table class="table"> <thead> <tr> <th>Product</th> <th>Item Price</th> <th>Quantity</th> <th>Total</th> <th>Actions</th> </tr> </thead> <tbody> @foreach($list as $data) <tr id="cart_box{{$data->attr_id}}"> <td> <div class="product-info"> <img width="80" src="{{ asset('storage/media/' . $data->image) }}" alt="{{ $data->name }}" /> <a href="#!">{{ $data->name }}</a> @if($data->size != '') <br/>SIZE: {{ $data->size }} @endif @if($data->color != '') <br/>COLOR: {{ $data->color }} @endif </div> </td> <td>Rs {{ $data->price }}</td> <td> <input id="qty{{$data->attr_id}}" class="aa-cart-quantity" type="number" value="{{$data->qty}}" onchange="updateQty('{{$data->pid}}','{{$data->size}}','{{$data->color}}','{{$data->attr_id}}','{{$data->price}}')"> </td> <td id="total_price_{{$data->attr_id}}">Rs {{ $data->price * $data->qty }}</td> <td> <a class="product-remove" href="#!" onclick="deleteCartProduct('{{ $data->pid }}', '{{ $data->size }}', '{{ $data->color }}', '{{ $data->attr_id }}')"> Remove</a> </td> </tr> @endforeach </tbody> </table> <a href="checkout.html" class="btn btn-main pull-right">Checkout</a> @endif </form> </div> </div> </div> </div> </div> </div> </div> <input type="hidden" id="qty" value="1"/> <form id="frmAddToCart"> <input type="hidden" id="size_id" name="size_id"/> <input type="hidden" id="color_id" name="color_id"/> <input type="hidden" id="pqty" name="pqty"/> <input type="hidden" id="product_id" name="product_id"/> @csrf </form> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script> function deleteCartProduct(pid, size, color, attr_id) { jQuery('#color_id').val(color); jQuery('#size_id').val(size); jQuery('#qty').val(0); add_to_cart(pid, size, color); jQuery('#total_price_' + attr_id).html('Rs 0'); jQuery('#cart_box' + attr_id).remove(); // Use remove() instead of hide() } function updateQty(pid, size, color, attr_id, price) { jQuery('#color_id').val(color); jQuery('#size_id').val(size); var qty = jQuery('#qty' + attr_id).val(); jQuery('#qty').val(qty); add_to_cart(pid, size, color); jQuery('#total_price_' + attr_id).html('Rs ' + qty * price); if (qty == 0) { jQuery('#cart_box' + attr_id).remove(); // Remove cart box if quantity is zero } } </script> @endsection