templates/cart/index.html.twig line 1
{% extends 'base.html.twig' %}{% block title %} Panier {% endblock %}{% block body %}<!-- ======================= Page Banner START --><section class="py-0"><div class="container"><div class="row"><div class="col-12"><div class="bg-light p-4 text-center rounded-3"><h1 class="m-0">Votre panier</h1><!-- Breadcrumb --></div></div></div></div></section><!-- =======================Page content START -->{% if cartProduct is not empty %}<section class="pt-5"><div class="container"><div class="row g-4 g-sm-5">{{ include ('components/flash_message.html.twig') }}<!-- Main content START --><div class="col-lg-2 mb-4 mb-sm-0"></div><div class="col-lg-8 mb-4 mb-sm-0">{% set total = 0 %}{% for key, product in cartProduct %}{% if product.product is not empty %}{% set subtotal = product.product.price * product._shop_qnty %}{% set total = total + subtotal %}{% endif %}<div class="card border bg-white card-body cart-item" style="overflow: hidden;"data-product-id=""><p class="text-lg-center text-black">{{ product.product ? product.product.socialnetwork : '' }} {{ product.product ? product.product.category : '' }}<a href="{{ path('remove_from_cart', {'productId': product.product_id}) }}"class="blockOther text-black-50 remove-button"style="float:right;cursor:pointer"><i class="fas fa-times"></i> Supprimer</a><span class="text-black" style="float:left;">{{ product.product.socialnetwork }}</span></p><img class="avatar avatar-lg float-start me-3"src="/service/{{ product.product.socialnetwork|lower }}.svg"alt="{{ product.product.quality }}"><hr><p class="text-black bi-shop"> {{ product._shop_src }}</p><hr><p class="text-black" style="text-align: left;">{{ product._shop_qnty }} рс.x {{ product.product ? product.product.price : '' }} {{ product.product.currency}} = {{ subtotal ? subtotal : '' }} {{ product.product.currency}} ({{ product.product ? product.product.quality : '' }})</p></div><br>{% endfor %}<!-- Card total START --><div class="card card-body p-4 shadow"><!-- Title --><h4 class="mb-3"></h4><!-- Button --><div class="d-grid"><a href="{{ path('app_checkout') }}" class="btn btn-lg btn-success">Passer à lacommande {{ total ? total : '' }} € </a></div></div><!-- Card total END --></div><!-- Main content END --></div><!-- Row END --></div></section><!-- =======================Page content END --><!-- ======================= Page Banner END -->{% else %}<section><div class="container"><div class="row"><div class="col-12 text-center"><!-- Image --><img src="/assets/images/element/cart.svg" class="h-200px h-md-300px mb-3" alt=""><!-- Subtitle --><h2>Votre panier est actuellement vide.</h2><!-- info --><p class="mb-0">Et si vous faisiez un tour dans notre catégorie ?</p><!-- Button --><a href="{{ path('app_defaut') }}" class="btn btn-primary mt-4 mb-0">Poursuivre mes achats</a></div></div></div></section>{% endif %}{% endblock %}{% block head_js %}{{ parent() }}<script src="https://code.jquery.com/jquery-3.5.1.js"></script><script>$(document).ready(function () {// Handle remove button click/* $('.remove-button').click(function() {// Get the parent cart item element and product IDvar cartItem = $(this).closest('.cart-item');var productId = cartItem.data('product-id');// Remove the cart item element from the DOMcartItem.remove();// Send an AJAX request to remove the item from the server-side cart$.ajax({url: '/cart/remove/' + productId,method: 'POST',success: function(data) {console.log('Item removed from cart');},error: function() {console.log('Error removing item from cart');}});*/});});</script>{% endblock %}