templates/frontend/cart.html.twig line 1

Open in your IDE?
  1. {% extends 'admin/base.html.twig' %}
  2. {% block title %}Votre panier{% endblock %}
  3. {% block CSS %}
  4. <link href="{{ asset('build/frontend/cart.css') }}" rel="stylesheet" type="text/css">
  5.   <link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
  6.   <link rel="stylesheet" href="/resources/demos/style.css">
  7. <link href="/assets/plugins/owl.carousel/dist/assets/owl.carousel.min.css" rel="stylesheet" type="text/css" />
  8. <link href="/assets/plugins/owl.carousel/dist/assets/owl.theme.default.min.css" rel="stylesheet" type="text/css" />
  9. {% endblock %}
  10. {% block JS %}
  11. <script src="{{ asset('build/frontend/cart.js') }}"></script>
  12. <script src="/assets/frontend/js/jquery-3.1.1.min.js"></script>
  13. <script src="/assets/plugins/owl.carousel/dist/owl.carousel.min.js"></script>
  14. <script>
  15.     jQuery(document).ready(function($) {
  16.         //Owl-Multi
  17.         $('#owl-multi').owlCarousel({
  18.             loop:true,
  19.             margin:20,
  20.             nav:false,
  21.             autoplay:true,
  22.             responsiveClass: true,
  23.             responsive:{
  24.                 0:{
  25.                     items:1
  26.                 },
  27.                 480:{
  28.                     items:2
  29.                 },
  30.                 700:{
  31.                     items:4
  32.                 },
  33.                 1000:{
  34.                     items:3
  35.                 },
  36.                 1100:{
  37.                     items:5
  38.                 }
  39.             }
  40.         })
  41.     });
  42. {# recupthisSelectforme #}
  43. {# $('#recupthisSelectforme').change(function() {
  44.     var conceptName = $('#recupthisSelectforme').val();
  45.         console.log(conceptName);
  46.         if (conceptName != 'none'){
  47.                $.ajax({
  48.                 type: "POST",
  49.                 url: '{{ path('subscriptionToProduct',{ 'id': 'conceptName'})  }}',
  50.                 async: true,
  51.                  data: {
  52.                         id: $('#recupthisSelectforme').val()
  53.                     },
  54.                 success: function () {
  55.                     console.log('success');
  56.                     window.location.reload()
  57.                 }
  58.             });
  59.         }
  60. }); #}
  61. $(document).on('change', 'select', function () {
  62.             var value = $(this).val();
  63.             $(this).find('option[value="' + value + '"]').attr("selected", "selected");
  64.                var subscriptionId = $('#recupthisSelectforme').find(":selected").val();    
  65.                var productId = $('#recupthisSelectforme').find(":selected").attr("data-productId");   
  66.             console.log(subscriptionId);
  67.             console.log(productId);
  68.             if (subscriptionId != 'none'){
  69.                $.ajax({
  70.                 type: "POST",
  71.                 url: '{{ path('subscriptionToProduct',{ 'id': 'subscriptionId'})  }}',
  72.                 async: true,
  73.                  data: {
  74.                         subscriptionId: $('#recupthisSelectforme').find(":selected").val(),
  75.                         productId : $('#recupthisSelectforme').find(":selected").attr("data-productId"),
  76.                     },
  77.                 success: function () {
  78.                     console.log('success');
  79.                     window.location.reload()
  80.                 }
  81.             });
  82.             }     
  83.         })
  84.  {# $('a[class=deleteProductCart]').on('click', function() {
  85.             var getValueinput = $(this).data('id');
  86.             if (getValueinput === 6472){
  87.                var answer = window.confirm("supression de la boite réutilisable ?");
  88.                 if (answer) {
  89.                     //some code
  90.                 }
  91.                 else {
  92.                     //some code
  93.                 }
  94.             }
  95.             console.log(getValueinput);
  96.         }); #}
  97.     
  98. </script>
  99. {% endblock %}
  100. {% block content %}
  101. {{form_start(form)}}
  102. <div class="row">
  103.     <div class="col-lg-10 col-xl-8 mx-auto">
  104.         <div class="product-purchase-list added-cart">
  105.             {# Checkout breadcrumb links #}
  106.             <div class="row">
  107.                 <div class="col-sm-12">
  108.                     <p class="product-subtitle-brand">
  109.                     <ul class="breadcrumb breadcrump-cart pull-right">
  110.                         <li><a href="{{path('viewCart')}}" class=""><u>Panier</u></a></li>
  111.                         {% if noGo is not defined %}
  112.                         <li><a href="{{path('checkout')}}">Livraison / Cueillette</a></li>
  113.                         {% if global.getCart.shippingAddress %}
  114.                         <li><a href="{{path('cartPayment')}}">Paiement</a></li>
  115.                         {% endif %}
  116.                         {% endif %}
  117.                         <li><a href="{{path('home')}}">Retour au magasin</a></li>
  118.                     </ul>
  119.                     </p>
  120.                 </div>
  121.             </div>
  122.             {# display user's subscriptions #}
  123.             {% if app.user and app.user.activeSubscriptions | length > 0 %}
  124.             <div class="card-box">
  125.                 <div class="m-t-40" {% if app.user.validSubscriptions | length==0 %} style="display:none;" {% endif %}>
  126.                     <h4 class="">
  127.                         <b>Joindre un abonnement à ma commande</b>
  128.                     </h4>
  129.                     <form action="{{path('viewCart')}}"  method="post"> 
  130.                     <div class="checkout-form">
  131.                         <select name="subscription" class="form-control" id="recupthisSelectforme">
  132.                             <option value="none">Aucune</option>
  133.                             {% for activeSubscription in app.user.activeSubscriptions %}
  134.                             <option value="{{activeSubscription.id}}" data-productId="{{activeSubscription.product.id}}" data-type="product">{{activeSubscription.product}}</option>
  135.                             {% endfor %}
  136.                         </select>
  137.                     </div>
  138.                     <form>
  139.                     <!--end checkout-form-->
  140.                 </div>
  141.             </div>    
  142.             {% endif %}
  143.             <hr>
  144.             {# Main section#}
  145.             <h4 class="m-b-20 cart-main-title">
  146.                 {{ form.products | length }}&nbsp;ARTICLE{% if form.products | length > 1%}S{%endif%} DANS VOTRE PANIER
  147.                 {% if noGo is not defined %}
  148.                 <input type="submit" value="Passer à la Livraison / Cueillette" class="btn btn-primary float-right phone-fullwidth" onclick="document.getElementById('se-pre-con').style.display='initial';">
  149.                 {% endif %}
  150.             </h4>
  151.             {% if not app.user %}
  152.                 <h5 style="text-align: center;">Vous avez un compte chez Maturin, <a href="{{path('fos_user_security_login')}}">connectez-vous / Inscription</a>.</h5>
  153.                 <br><br>
  154.             {% endif %}
  155.             {% if  global.getCart.products | length < 1 %}
  156.                 <div style="background-color: white; padding-top: 15px; padding-bottom: 15px;"> <h5 style="text-align: center;">Votre panier est vide</h5></div>
  157.             {% endif %}
  158.             <div class="cart_product {% if global.getCart.products | length < 1 %}d-none{% endif %}" style="background-color: white; padding-top: 15px; padding-bottom: 15px;">
  159.                 {# MATURIN No JIT SHIPPING #}
  160.                 {% set amountOfShipment = 1 %}
  161.                 {% if global.getCart.hasMaturinShipping %}
  162.                     {{include('frontend/cartListingProduct.html.twig', {mode: 'maturin'})}}
  163.                 {% endif %}
  164.                 {# CUSTOM SHIPPING #}
  165.                 {% if global.getCart.hasCustomShipping %}
  166.                    <br>
  167.                     <hr/>
  168.                     <br>
  169.                     {% if global.getCart.totalOfShipment > 1 %}
  170.                         {% set amountOfShipment = amountOfShipment + 1 %}
  171.                     {% endif %}
  172.                     {{include('frontend/cartListingProduct.html.twig', {mode: 'custom'})}}
  173.                 {% endif %}
  174.                 {# PICKUP #}
  175.                 {% if global.getCart.hasPickup %}
  176.                     <br>
  177.                     {# <hr/> #}
  178.                     <br>
  179.                     {{include('frontend/cartListingProduct.html.twig', {mode: 'pickup'})}}
  180.                 {% endif %}
  181.                 {# {% set route = global.getEstimationShippingRouteForMaturinProducts(global.getCart)  %}
  182.                 {% if route['route'] is not null and not route['route'].isPuro and app.user.hasReusableBox == false %}
  183.                     <div class="checkout-form mt-3 mb-2" style="text-align: center;">
  184.                         <input type="checkbox" name="reusableBox" value="addBox" checked>Ajouter une glaciere réutilisable a votre panier ? (consigne 15$)</input>
  185.                     </div>
  186.                 {% endif %} #}
  187.             </div>
  188.             {# INFOS about minimal cart amount #}
  189.             {% if global.getCart.hasMaturinDeliveryProducts %}
  190.               {% if global.getCart.totalProductsMaturinDeliveryOnly < 25 %}
  191.                   <h5>Information: Minimum de commande de 25$ pour les produits livrés par Maturin</h5>
  192.               {% else %}
  193.                   <h5>Minimum de commande de 25$ atteint pour les produits livrés par Maturin</h5>
  194.               {% endif %}
  195.               <h5>Livraison Gratuite à Montréal, Laval, Longueuil sur commande de 75$ et plus, pour les produits livrés par Maturin.</h5>
  196.             {% endif %}
  197.             {# Navigation links and cart sub-total #}
  198.             <div class="row ">
  199.                 <div class="col-md-6 align-self-center">
  200.                     <div class="total-calculate">
  201.                         <a href="{{path('allCategory')}}" class="continue-shopping-link"><i class="ti ti-arrow-left mr-2"></i>Retour au magasin</a>
  202.                     </div>
  203.                 </div><!-- end col -->
  204.                 <div class="col-md-6">
  205.                     <div class="total-calculate text-right">
  206.                         <div class="cart-subtotal font-weight-bold">
  207.                             <p>
  208.                                 <span class="">SOUS-TOTAL </span>{{cart.subTotalToPay(false)|number_format(2)}}$</p>
  209.                         </div>
  210.                         {% if noGo is not defined and form.recurring is defined %}
  211.                             <div class="row">
  212.                                 <div class="col-sm-12">
  213.                                     {{form_row(form.recurring)}}
  214.                                 </div>
  215.                             </div>
  216.                         {% endif %}
  217.                         <div class="row">
  218.                             <div class="col-sm-12">
  219.                                 {{ form_widget(form.update)}}
  220.                                 {% if noGo is defined %}
  221.                                     {{ form_widget(form.submit, {'attr': { 'style': 'display:none;'}})}}
  222.                                 {% else %}
  223.                                     {{ form_widget(form.submit)}}
  224.                                 {% endif %}
  225.                             </div>
  226.                         </div>
  227.                     </div><!-- end total-calculate -->
  228.                 </div><!-- end col -->
  229.             </div><!-- end row -->
  230.             <br>
  231.             {# INFOS about minimal cart amount #}
  232.             {% if global.getCart.totalProducts < 25 and not global.getCart.hasPromotionalProduct and suggestedProducts is not empty %}
  233.                 <h4>Voici nos suggestions pour compléter votre panier</h4>
  234.             {% elseif suggestedProducts is not empty %}
  235.                 <h4>Ne passez pas à côté de ces offres exclusives</h4>
  236.             {% endif %}
  237.             <hr>
  238.             {# Suggest some produts#}
  239.             {%  if suggestedProducts is not empty %}
  240.             <div class="row">
  241.                     <div class="col-sm-12">
  242.                         <div class="owl-carousel owl-theme" id="owl-multi">
  243.                             {% for p in suggestedProducts %}
  244.                                 <div class="item">
  245.                                     <a href="{{path('viewProduct', {'producerUrl':p.company.UrlName, 'productName': p.UrlName, 'id': p.Id})}}" style="color: black; font-weight: bold;">
  246.                                         <img src="{{path('getImageAsCroppedThumb', {id: p.mainImage.id, height: '250', width: '250'})}}" alt="{{p.name}}" class="cart-image" style="max-width: 100%;">
  247.                                         {{p.Name}}
  248.                                     </a>
  249.                                     <div class="product-subtitle">
  250.                                         <a href="{{path('companyStore', {'urlname': p.company.urlname, 'id':p.company.id })}}" style="font-size: 12px; color: black;">{{p.company.name}}</a>
  251.                                     </div>
  252.                                     <div class="product-subtitle" style="color: black; font-weight: bold;">
  253.                                         {{p.displayPrice}}
  254.                                     </div>
  255.                                     <div class="product-subtitle">
  256.                                         <a class="btn btn-warning waves-effect waves-light" href="{{path('addProductAtCart', {'id': p.id})}}">
  257.                                             AJOUTER AU PANIER
  258.                                         </a>
  259.                                     </div>
  260.                                 </div>
  261.                             {% endfor %}
  262.                         </div>
  263.                     </div>
  264.             </div>
  265.             {% endif %}
  266.         </div><!-- end product-purchase-list -->
  267.     </div><!-- end col -->
  268. </div><!-- end row -->
  269. {% if noGo is defined %}
  270. {{form_end(form, {'render_rest': false}) }}
  271. {% else %}
  272. {% do form.products.setRendered %}
  273. {{form_end(form) }}
  274. {% endif %}
  275. <script src="/assets/admin/js/jquery.min.js" type="text/javascript"></script>
  276. {% endblock %}