templates/frontend/cartListingProduct.html.twig line 1

Open in your IDE?
  1. {% set cmtp = 0 %}
  2. {# @NOTE if form is defined it's a editable display #}
  3. {% if form is defined %}
  4.     {% set products = form.products %}
  5.     {% set editable = true %}
  6. {% else %}
  7.     {% set products = app.user.cart.products %}
  8.     {% set editable = false %}
  9. {% endif %}
  10. <h4 class="page-title" style="font-size: 15px;font-weight: bold; text-align: right; padding-right: 15px;">
  11.     {% if mode != 'pickup' %}
  12.       {% if global.getCart.totalOfShipment > 1 %}
  13.         Livraison {{amountOfShipment}} sur {{global.getCart.totalOfShipment}} -
  14.       {% endif %}
  15.     {% endif %}
  16.     {% if mode == 'maturin' %}
  17.         Livraison par Maturin ou Cueillette disponible, recevez-le
  18.         {% set route = global.getEstimationShippingRouteForMaturinProducts(global.getCart)  %}
  19.          {% set dateDelivery = global.getCart.getDeliveryChoiceDate  %}
  20.         {% if dateDelivery != null %}
  21.             {{dateDelivery  | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM YYYY') }}
  22.         {% else %} 
  23.             {% if route['route'] is not null and not route['route'].isPuro %}
  24.                 {{route['date'] | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM YYYY')  }}
  25.             {% else %}
  26.                 entre {{route['date'] | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM YYYY')  }}
  27.                 et {{global.add48hToDate(route['date']) | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM YYYY')  }}
  28.             {% endif %}
  29.         {% endif %} 
  30.          entre 12h et 21h
  31.         <br>
  32.         {% if app.user %}
  33.           {% if app.user.hasReusableBox %}
  34.             <p> Vous avez une glacière réutilisable.</p>
  35.           {% else %}
  36.             {% if global.getCart.containReusableBox == false %}
  37.               <p> Vous pouvez obtenir <a href="{{path('viewProduct', {'producerUrl': global.getReusableBoxProduct.company.getUrlName, 'productName': global.getReusableBoxProduct.getUrlName, 'id': global.getReusableBoxProduct.getId })}}" >une glacière réutilisable ici</a>.</p>
  38.             {% endif %}
  39.           {% endif %}
  40.         {% endif %}
  41.     {% elseif mode == 'pickup'  %}
  42.         *** Cueillette disponible ***
  43.     {% elseif mode == 'custom' %}
  44.         Livraison indépendante{% if editable %}, veuillez choisir votre livraison...{% endif %}
  45.     {% endif %}
  46. </h4>
  47. {% for rawProduct in products %}
  48.     {# @NOTE if form is defined it's a editable display #}
  49.     {% if editable %}
  50.         {% set p = rawProduct.vars.value.product %}
  51.         {% set cartProduct  = rawProduct.vars.value %}
  52.     {% else %}
  53.         {% set p = rawProduct.product %}
  54.         {% set cartProduct  = rawProduct %}
  55.     {% endif %}
  56.     {# define which kind of product has to be shipped#}
  57.     {% set display = false %}
  58.     {% if mode == 'maturin' and cartProduct.isShippedByMaturin and not cartProduct.isAPickUp  %}
  59.         {% set display = true %}
  60.     {% elseif mode == 'custom' and not cartProduct.isShippedByMaturin and not cartProduct.isAPickUp%}
  61.         {% set display = true %}
  62.     {% elseif mode == 'pickup' and cartProduct.isAPickUp  %}
  63.         {% set display = true %}
  64.     {% endif %}
  65.     {% if display %}
  66.     {% set cmtp = cmtp + 1 %}
  67.     <div class="row" style="{% if cmtp == 1 %}padding-top: 15px;{% endif %}padding-bottom: 10px;margin-left: 15px; margin-right: 15px;">
  68.         {% if alert_nodelivery_alcohol is defined %}
  69.         {% set p_isAlcohol = FALSE %}
  70.           {% if p.isBoxOfProducts %}
  71.             {% set boxProducts = p.getProductsInBox() %}
  72.             {% for bP in boxProducts %}
  73.               {% if bP.getProduct().isAlcohol %}
  74.                 {% set p_isAlcohol = TRUE %}
  75.               {% endif %}
  76.             {% endfor %}
  77.           {% endif %}
  78.           {% if p.isAlcohol %}
  79.             {% set p_isAlcohol = TRUE %}
  80.           {% endif %}
  81.           {% if p_isAlcohol == TRUE %}
  82.           <div class="row" style="padding-bottom: 10px;margin-left: 15px; margin-right: 15px;">
  83.             <div class="col-md-12">
  84.               <div class="alert alert-danger" role="alert">
  85.                 <strong>
  86.                   Ce produit n'est pas disponible selon votre adresse, la livraison de produits alcoolisés n’est pas offerte dans votre région.
  87.                   Pour poursuivre votre commande, veuillez supprimer ce produit de votre panier.
  88.                 </strong>
  89.               </div>
  90.             </div>
  91.           </div>
  92.           {% endif %}
  93.         {% endif %}
  94.         {% if alert_nodelivery_puro is defined %}
  95.         {% set p_PuroExclusion = FALSE %}
  96.           {% if p.isBoxOfProducts %}
  97.             {% set boxProducts = p.getProductsInBox() %}
  98.             {% for bP in boxProducts %}
  99.               {% if bP.getProduct().puroExclusion %}
  100.                 {% set p_PuroExclusion = TRUE %}
  101.               {% endif %}
  102.             {% endfor %}
  103.           {% endif %}
  104.           {% if p.puroExclusion %}
  105.             {% set p_PuroExclusion = TRUE %}
  106.           {% endif %}
  107.           {% if p_PuroExclusion == TRUE %}
  108.           <div class="row" style="padding-bottom: 10px;margin-left: 15px; margin-right: 15px;">
  109.             <div class="col-md-12">
  110.               <div class="alert alert-danger" role="alert">
  111.                 <strong>
  112.                   Ce produit n'est pas disponible selon votre adresse, la livraison de ce produit n’est pas offerte dans votre région.
  113.                   Pour poursuivre votre commande, veuillez supprimer ce produit de votre panier.
  114.                 </strong>
  115.               </div>
  116.             </div>
  117.           </div>
  118.           {% endif %}
  119.         {% endif %}
  120.         {% if alert_nodelivery_cold is defined %}
  121.         {% set p_isCold = FALSE %}
  122.           {% if p.isBoxOfProducts %}
  123.             {% set boxProducts = p.getProductsInBox() %}
  124.             {% for bP in boxProducts %}
  125.               {% if bP.getProduct().isCold %}
  126.                 {% set p_isCold = TRUE %}
  127.               {% endif %}
  128.             {% endfor %}
  129.           {% endif %}
  130.           {% if p.isCold %}
  131.             {% set p_isCold = TRUE %}
  132.           {% endif %}
  133.           {% if p_isCold == TRUE %}
  134.           <div class="row" style="padding-bottom: 10px;margin-left: 15px; margin-right: 15px;">
  135.             <div class="col-md-12">
  136.               <div class="alert alert-danger" role="alert">
  137.                 <strong>
  138.                   Ce produit n'est pas disponible selon votre adresse, la livraison de produits réfrigérés et congelés n’est pas offerte dans votre région.
  139.                   Pour poursuivre votre commande, veuillez supprimer ce produit de votre panier.
  140.                 </strong>
  141.               </div>
  142.             </div>
  143.           </div>
  144.           {% endif %}
  145.         {% endif %}
  146.         {% if editable %}
  147.         <div class="col-md-1 text-right"><a href="#" class="deleteProductCart" data-id="{{p.id}}"><i class="ion-close" style="font-size: x-large;color: darkgray;"></i></a></div>
  148.         {% endif %}
  149.         <div class="col-md-2" style="text-align: center;">
  150.             <a href="{{path('viewProduct', {producerUrl: p.company.urlName, productName: p.urlName, id:p.id})}}">
  151.                 <img src="{{path('getImageAsCroppedThumb', {id: p.mainImage.id, height: '150', width: '150'})}}" alt="{{p.name}}" class="cart-image" style="max-width: 100%;">
  152.             </a>
  153.         </div>
  154.         <div class="{% if editable %}col-md-9{% else %}col-md-10{% endif %}">
  155.             <div class="row text-center text-md-left">
  156.             <a href="{{path('viewProduct', {producerUrl: p.company.urlName, productName: p.urlName, id:p.id})}}" class="col-sm-10">
  157.                 <h5 class="font-weight-bold cart-product-name " {% if global.isDev %}cp-id="{{ cartProduct.id }}"{% endif %}>
  158.                     {{p.name |upper}}
  159.                     {% if cartProduct.isShippedByMaturin %}
  160.                         {% set route = global.estimationShippingRoute(p)  %}
  161.                         {% if editable %}
  162.                         {% if p.isJustInTime %}
  163.                             {% if route['route'] is not null and not route['route'].isPuro %}
  164.                                 <span class="pull-lg-right text-left ml-4">
  165.                                     Disponible {{route['date'] | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM')}}
  166.                                 </span>
  167.                             {% else %}
  168.                                 <span class="pull-lg-right text-left ml-4">
  169.                                     Disponible entre {{route['date'] | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM')}}
  170.                                     et {{global.add48hToDate(route['date']) | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM')}}
  171.                                 </span>
  172.                             {% endif %}
  173.                         {% else %}
  174.                         {#<span class="pull-right">#}
  175.                             <span class="pull-lg-right text-center ml-4">
  176.                                 {% if p.qtyReadyToShip > 0%}
  177.                                     {% if route['route'] is not null and not route['route'].isPuro %}
  178.                                         Disponible {{route['date'] | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM')}}
  179.                                     {% else %}
  180.                                         Disponible entre {{route['date'] | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM')}}
  181.                                         et {{global.add48hToDate(route['date']) | localizeddate('medium', 'none', null, '-7', 'EEEE d MMMM')}}
  182.                                     {% endif %}
  183.                                 {% else %}
  184.                                     Inventaire épuisé
  185.                                 {% endif %}
  186.                             </span>
  187.                         {% endif %}
  188.                         {% endif %}
  189.                     {% else %}
  190.                         <span class="pull-right"></span>
  191.                     {% endif %}
  192.                 </h5>
  193.             </a>
  194.             </div>
  195.             <div class="row m-l-2 text-center text-md-left">
  196.                 <a href="{{path('companyStore', {urlname: p.urlName, id: p.company.id})}}" class="col-sm-10">
  197.                     {{p.company.name}}<br>
  198.                 </a>
  199.             </div>
  200.             <div class="row text-center text-md-left">
  201.                 <h5 class="col-sm-10">
  202.                     {% if p.qtyPerUnit > 1 %}{{p.qtyPerUnit}} x {% endif %} {{p.getWeightinGramme}}
  203.                    
  204.                 </h5>
  205.             </div>
  206.             <div class="row">
  207.             {% if p.pricings | length > 1 %}
  208.                 <h5 class="cart-multiple-pricing" data-id="pricing_{{p.id}}">
  209.                     Format économique disponible
  210.                 </h5>
  211.                 <ul id="pricing_{{p.id}}" style="display:none;">
  212.                     {% for price in p.pricings %}
  213.                     <li>{{price.displayPrice}}</li>
  214.                     {% endfor %}
  215.                 </ul>
  216.             {% endif %}
  217.             </div>
  218.             {% if editable %}
  219.                 <div class="row m-t-10">
  220.                     <div class="col-3">
  221.                         {% if cartProduct.overwriteSubscription %}
  222.                         {{form_widget(rawProduct.quantity, {'disabled': true})}}
  223.                         {% else %}
  224.                             {{form_widget(rawProduct.quantity)}}
  225.                         {% endif %}
  226.                     </div>
  227.                     <div class="{% if p.isSubscribable %}col-3{% else %}col-9{% endif %}" style="padding-top: 5px;">
  228.                         {% if not cartProduct.product.isSubscribable %}
  229.                         x
  230.                         {% else %}
  231.                             à
  232.                         {% endif %}
  233.                         {% if cartProduct.hasDiscountFromQuantity and p.pricePerProduct > p.pricePerProduct %}
  234.                             <div class="cart-quantity-reduction">{{p.pricePerProduct | number_format(2)}} $</div>
  235.                             <s>{{p.pricePerProduct | number_format(2)}} $</s>
  236.                         {% else %}
  237.                             {% if cartProduct.quantity == 1 and cartProduct.couponSavings > 0 %}
  238.                             <strike>{{cartProduct.total(false)}}</strike> {{cartProduct.total(true)| number_format(2)}} $
  239.                             {% else %}
  240.                                 {{p.pricePerProduct | number_format(2)}} $
  241.                             {% endif %}
  242.                         {% endif %}
  243.                         {% if cartProduct.quantity > 1 and not cartProduct.product.isSubscribable %}
  244.                             {% if cartProduct.couponSavings > 0 %}
  245.                                 pour <strike>{{cartProduct.total(false)}}$</strike> {{cartProduct.total(true)}}$
  246.                             {% else %}
  247.                                 pour {{cartProduct.total(false)}}$
  248.                             {% endif %}
  249.                         {% endif %}
  250.                     </div>
  251.                     {% if p.isSubscribable %}
  252.                         <div class="col-6">
  253.                             {% if cartProduct.overwriteSubscription %}
  254.                             {{form_widget(rawProduct.recurringFrequency, {'disabled' :true })}}
  255.                             {% else %}
  256.                                 {{form_widget(rawProduct.recurringFrequency)}}
  257.                             {% endif %}
  258.                         </div>
  259.                     {% endif %}
  260.                 </div>
  261.             {% else %}
  262.                 <div class="row m-t-10">
  263.                     <div class="col-12">
  264.                         <div class="row text-center text-md-left">
  265.                             <span class="col-sm-10">
  266.                                 {% if rawProduct.product.isSubscribable %}
  267.                                     {{rawProduct.quantity}}
  268.                                     {% if rawProduct.recurringFrequency == 2 %}
  269.                                         Abonnement hebdomadaire
  270.                                     {% elseif rawProduct.recurringFrequency == 3 %}
  271.                                         Abonnement bi-mensuel
  272.                                     {% elseif rawProduct.recurringFrequency == 4 %}
  273.                                         Abonnement mensuel
  274.                                     {% endif %}
  275.                                 {% else %}
  276.                                     {{rawProduct.quantity}}
  277.                                 {% endif %}
  278.                                 {% if not cartProduct.product.isSubscribable %} x {% else %} x {% endif %}
  279.                             {% if cartProduct.hasDiscountFromQuantity and p.pricePerProduct > p.pricePerProduct %}
  280.                                 <div class="cart-quantity-reduction">{{p.pricePerProduct | number_format(2)}} $</div>
  281.                                 <s>{{p.pricePerProduct | number_format(2)}} $</s>
  282.                             {% else %}
  283.                                 {% if cartProduct.quantity == 1 and cartProduct.couponSavings > 0 %}
  284.                                 <strike>{{cartProduct.total(false)}}</strike> {{cartProduct.total(true)| number_format(2)}} $
  285.                                 {% else %}
  286.                                     {% if cartProduct.product.isSubscribable %}
  287.                                         {{cartProduct.total| number_format(2)}} $
  288.                                     {% else %}
  289.                                         {{p.pricePerProduct | number_format(2)}} $
  290.                                     {% endif %}
  291.                                 {% endif %}
  292.                                  </span>
  293.                         </div>
  294.                         {% endif %}
  295.                         <div class="row text-center text-md-left">
  296.                         <span class="col-sm-10">
  297.                         {% if cartProduct.quantity > 1 and not cartProduct.product.isSubscribable %}
  298.                             {% if cartProduct.couponSavings > 0 %}
  299.                                 pour <strike>{{cartProduct.total(false)}}$</strike> {{cartProduct.total(true)}}$
  300.                             {% else %}
  301.                                 pour {{cartProduct.total(false)}}$
  302.                             {% endif %}
  303.                         {% endif %}
  304.                         {% if cartProduct.product.isSubscribable %}
  305.                             par envois
  306.                         {% endif %}
  307.                         </span>
  308.                         </div>
  309.                         {% if cartProduct.addedWhenBeingInAssociation and cartProduct.companyDeliveryMethod %}
  310.                             <div class="row">
  311.                                 <div class="col-12">
  312.                                     {% set dm = cartProduct.companyDeliveryMethod %}
  313.                                     {% if dm.isAPickup %}
  314.                                         <div class="row">
  315.                                             <strong>Information de ramassage:</strong>
  316.                                         </div>
  317.                                         <div class="row">
  318.                                             {{dm.pickupAddress}}
  319.                                         </div>
  320.                                     {% endif %}
  321.                                 </div>
  322.                             </div>
  323.                         {% endif %}
  324.                     </div>
  325.                 </div>
  326.             {% endif %}
  327.             {% if editable and not cartProduct.isShippedByMaturin %}
  328.                 <div class="row">
  329.                 {% if cartProduct.isAPickup %}
  330.                     <span style="display: none">
  331.                         {{form_row(rawProduct.companyDeliveryMethod)}}
  332.                     </span>
  333.                 {% elseif cartProduct.companyDeliveryMethod is not empty %}
  334.                     <!-- return by DeliveryMethod->__toString() -->
  335.                     {{form_row(rawProduct.companyDeliveryMethod)}}
  336.                 {% elseif cartProduct.validDeliveryMethods() is not empty %}
  337.                     {{form_row(rawProduct.companyDeliveryMethod)}}
  338.                 {% endif %}
  339.                 {% if cartProduct.addedWhenBeingInAssociation and cartProduct.companyDeliveryMethod %}
  340.                     {% set dm = cartProduct.companyDeliveryMethod %}
  341.                     {% if dm.isAPickup %}
  342.                         <span style="font-weight: bold;font-size: larger;">
  343.                         {{dm.pickupAddress}}<br><br><br>
  344.                         </span>
  345.                     {% endif %}
  346.                 {% endif %}
  347.                 </div>
  348.             {% endif %}
  349.         </div>
  350.     </div>
  351.     {% endif %}
  352. {% endfor %}