Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 18.118.193.226
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : cart.blade.php
<x-main.header />

<main>
    <section class="cart-mart">
        <div class="container">
            <div class="row align-items-start">
                <div class="col-12 col-md-12">
                    <div class="main-cart">
                        <h2>Carts</h2>
                    </div>
                </div>

            </div>


            @php
                $cart = DB::select("SELECT * FROM `carts`");
                @endphp

                @php
                $total = 0;
                @endphp

                @if($cartItem->count() > 0)
                @foreach($cartItem as $key => $item)

            <div class="row mb-5 mt-5 " style="border-bottom:1px solid #A2A3B1; padding:0 0 30px 0;">
                <div class="col-12 col-md-2 mt-3">
                    <div class="glass-one">
                        <img src="{{ asset('storage/images/'.$item->product->product_image) }}" class="img-fluid" alt="img">
                    </div>
                </div>
               
                <div class="col-12 col-md-5 mt-4">
                    <div class="one-glass">
                        <!-- <h4>Complete Cleansing Oil</h4> -->
                        <ul>
                            <li>
                                <h5>Product:</h5>
                                <p>{{ $item->product->product_front_title }}</p>
                            </li>
                            <li>
                                <h5>Color:</h5>
                                <p>@if($item->color)
                                                        - {{ $item->color->color_name }}
                                                        @endif</p>
                            </li>
                            <li>
                                <h5>Size:</h5>
                                <p>{{ $item->size_id }}
                                                      </p>
                            </li>
                            <li>
                                
                            </li>
                        </ul>
                    </div>
                    @if($item->product->product_quantity >= $item->product_quantity)
                    <div class="quantity different" element-id="171">
                        <button class="dec" fdprocessedid="157srp" element-id="170">-</button>
                        <input data-id="{{ $item->id }}" data-pro_id="{{ $item->product_id }}" min="1" value="{{ $item->product_quantity }}" type="text" name="proQuantity" id="proQuantity" fdprocessedid="5xhskf" element-id="169">
                        <button class="inc" fdprocessedid="g66wvf" element-id="168">+</button>
                    </div>
                    @if($item->color && $item->size)
                                            @php
                                            $total += ($item->product->product_origional_price + $item->color->color_price + $item->size->price) * $item->product_quantity
                                            @endphp
                                            @elseif($item->color)
                                            @php
                                            $total += ($item->product->product_origional_price + $item->color->color_price) * $item->product_quantity
                                            @endphp
                                            @elseif($item->size)
                                            @php
                                            $total += ($item->product->product_origional_price + $item->size->price) * $item->product_quantity
                                            @endphp
                                            @else
                                            @php
                                            $total += $item->product->product_origional_price * $item->product_quantity
                                            @endphp
                                            @endif
                                            @else
                                            <p>Out Of Stock</p>
                                            @endif
                </div>
                <div class="col-12 col-md-4 d-flex justify-content-end  mt-3">
                    <div class="last-cart">
                    <h6>Price:</h6>
                                <h4>usd
                                            @if($item->color && $item->size)
                                            {{ $item->product->product_origional_price + $item->color->color_price + $item->size->price }}
                                            @elseif($item->color)
                                            {{ $item->product->product_origional_price + $item->color->color_price }}
                                            @elseif($item->size)
                                            {{ $item->product->product_origional_price + $item->size->price }}
                                            @else
                                            {{ $item->product->product_origional_price }}
                                            @endif</h4>

                    </div>
                    
                </div>
               
            </div>
      
            @endforeach
                                    @else
                                    @endif

            <a href="{{ url('/checkout') }}" class="mart-858 checkout-btn" style="margin:10px auto!important; display:block;" onclick="choosproducts()">
            proceed to checkout
</a>
        </div>
       
    </section>



  
</main>

<script>
    // Update Cart

    $(document).ready(function() {
        $("body").on('click', '#update_cart', function(e) {

            // var id = $(this).val();
            $(".cart-sec .cart-table .quantity input").each(function() {

                var id = $(this).data("id");
                var pro_id = $(this).data("pro_id");
                var qty = $(this).val();

                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
                });

                $.ajax({
                    url: "{{ url('/update_cart') }}",
                    method: "POST",
                    data: {
                        id: id,
                        pro_id: pro_id,
                        qty: qty
                    },
                    success: function(data) {
                        if (data.loginerror) {
                            toastr.error(data.loginerror, "Error", {
                                timeOut: 1500
                            });
                            $("#login").modal('show');
                        } else if (data.error) {
                            toastr.error(data.error, "Error", {
                                timeOut: 1500
                            });
                            return false;
                        } else if (data.success) {
                            toastr.success(data.success, "Success", {
                                timeOut: 1500
                            });
                            location.reload();
                            // window.location = "{{ url('/cart') }}";
                             updateCartCount();
                        }
                    },
                    error: function() {
                        toastr.error("SomeThing Went Wrong", "Error", {
                            timeOut: 1500
                        });
                        return false;
                    },
                });
            });

        });
    });

    // Coupon Work
    $(document).ready(function() {
        $('body').on('click', '#copan_btn', function(event) {
            event.preventDefault();

            var coupan = $("#copan").val();

            if (!coupan) {
                toastr.error("Please Enter Coupon", "Error", {
                    timeOut: 1500
                });
                return false;
            }
            // else
            // {
            //     toastr.error("Invalid Coupon","Error",{timeOut: 1500});
            //     false;
            // }

            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                url: "{{ url('/add_coupon') }}",
                method: "GET",
                data: {
                    coupan: coupan
                },
                success: function(data) {
                    if (data.notfound) {
                        toastr.error(data.notfound, "Error", {
                            timeOut: 1500
                        });
                        return false;
                    } else if (data.expire) {
                        toastr.error(data.expire, "Error", {
                            timeOut: 1500
                        });
                        return false;
                    } else if (data.success) {
                        toastr.success(data.success, "Success", {
                            timeOut: 1500
                        });
                        $("#checkout").load(location.href + " #checkout>*", "");
                    }
                },
                error: function() {

                },
            });

        });
    });
    // Coupon Work End Here
</script>

<!-- Delete Work -->

<script>
    $(document).ready(function() {
        $("body").on("click", "#btn_delete", function(e) {
            e.preventDefault();

            var id = $(this).val();

            $.ajax({
                url: "{{ url('/delete_cart') }}",
                method: "GET",
                data: {
                    'id': id
                },
                cache: false,
                success: function() {
                    toastr.success("Item Deleted Successfully", "Deleted", {
                        timeOut: 1500
                    });
                    $("#showItem").load(location.href + " #showItem>*", "");
                    $("#checkout").load(location.href + " #checkout>*", "");
                    $("#offcanvasbody").load(location.href + " #offcanvasbody>*", "");
                    updateCartCount();
                },
                error: function() {
                    toastr.error("SomeThing Went Wrong", "Error", {
                        timeOut: 1500
                    });
                    false;
                },
            });
        })
        updateCartCount();
    });
</script>

<x-main.footer />
© 2025 GrazzMean-Shell