templates/website/cart/cart-section-list.html.twig line 1

Open in your IDE?
  1. {% from 'utils.html.twig' import ico, imgUpload %}
  2. <div id="cart-list--content" class="cart step-container" data-expand="true">
  3.     {# PRODUCT LIST #}
  4.     <div class="product-list">
  5.         {% set showDiscount = (cartSubtotalDiff > 0) %}
  6.         {% for cart in carts %}
  7.             {% set hasAppliedCoupon = false %}
  8.             {% set hasAvaliablePublicCoupons = false %}
  9.             {# HAS COUPON #}
  10.             {% if isModuleActive('product_coupon_module') %}
  11.                 {# HAS COUPON APPLIED #}
  12.                 {% set hasAppliedCoupon = cart.productCoupon is not empty %}
  13.                 {# HAS COUPONS AVALIABLE #}
  14.                 {% set hasAvaliablePublicCoupons = cart.productOfferCouponTotal > 0 %}
  15.             {% endif %}
  16.             <div class="product cart-box">
  17.                 <div class="content-cart">
  18.                     <div class="cover">
  19.                         <div class="mini">
  20.                             {{ 
  21.                                 imgUpload(
  22.                                     cart.productOffer.productPage.photo, 
  23.                                     enum('AbstractEnum::PATH_PRODUCT_PHOTO'), 
  24.                                     'product-photo',
  25.                                     cart.product.title
  26.                                 )
  27.                             }}
  28.                         </div>
  29.                     </div>
  30.                     <h3 class="title">{{ cart.product.title }}</h3>
  31.                     {# PRICE #}
  32.                     {% set infoCycle = installmentPeriodText(cart.productOffer.planCycle) %}
  33.                     <div class="price">
  34.                         {# TRIAL #}
  35.                         {% if cart.productOffer.allowTrial and not userHasProduct(cart.product, true) %}
  36.                             <p class="trial">{{ cart.productOffer.trialPeriod }} {{ getLanguage('free_days', 'cart') }}</p>
  37.                         {# NO TRIAL #}
  38.                         {% else %}
  39.                             {% set priceOriginal = null %}
  40.                             {# HAS COUPON APPLIED #}
  41.                             {% if hasAppliedCoupon %}
  42.                                 {% set priceOriginal = cart.productOffer.priceReal %}
  43.                             {% endif %}
  44.                             {# HAS DISPLAY #}
  45.                             {% if cart.productOffer.priceDisplay > cart.price %}
  46.                                 {% set priceOriginal = cart.productOffer.priceDisplay %}
  47.                             {% endif %}
  48.                             {% if priceOriginal is not null %}
  49.                                 <small class="price-original">
  50.                                     {{ getLanguage('of', 'cart') }} <s>{{ cart.productOffer.currencySymbol }} {{ priceOriginal|number_format(2, ',', '.') }}</s> {{ getLanguage('by', 'cart') }}
  51.                                 </small>
  52.                             {% endif %}
  53.                             {% set infoParcel = getOfferParcelInfo(cart.productOffer, cart) %}
  54.                             <p class="price-offer">
  55.                                 {% if infoParcel.maxInstallments > 1 %}
  56.                                     {{ infoParcel.maxInstallments }}x {{ cart.productOffer.currencySymbol }}&ensp;{{ infoParcel.parcelPrice|number_format(2, ',', '.') }}
  57.                                 {% else %}
  58.                                     {{ cart.productOffer.currencySymbol }} {{ cart.price|number_format(2, ',', '.') }}
  59.                                     {% if cart.productOffer.product.type == enum('ProductEnum::SUBSCRIPTION') or cart.productOffer.allowRecurrency == enum('ProductOfferEnum::YES') %}
  60.                                         /{{ infoCycle.text }}
  61.                                     {% endif %}
  62.                                 {% endif %}
  63.                             </p>
  64.                             {% if infoParcel.maxInstallments > 1 %}
  65.                                 <p class="preco-atual">
  66.                                     {{ getLanguage('or', 'cart') }} 
  67.                                     <small>
  68.                                         {{ cart.productOffer.currencySymbol }} {{ cart.price|number_format(2, ',', '.') }}
  69.                                         {% if cart.productOffer.product.type == enum('ProductEnum::SUBSCRIPTION') or cart.productOffer.allowRecurrency == enum('ProductOfferEnum::YES') %}
  70.                                             /{{ infoCycle.text }}
  71.                                         {% endif %}
  72.                                     </small>
  73.                                 </p>
  74.                             {% endif %}
  75.                     
  76.                             {# MEMBERSHIP FEE #}
  77.                             {% if cart.membershipFee > 0 %}
  78.                                 {% if cart.productCoupon is not empty
  79.                                   and cart.productCoupon.applyMembershipFee == enum('ProductCouponEnum::YES')
  80.                                   and isModuleActive('product_coupon_module') %}
  81.                                     <del class="price-membership">+ {{ getLanguage('membership_fee_of', 'cart') }} {{ cart.productOffer.currencySymbol }} {{ cart.membershipFee|number_format(2, ',', '.') }}</del>
  82.                                 {% else %}
  83.                                     <p class="price-membership">+ {{ getLanguage('membership_fee_of', 'cart') }} {{ cart.productOffer.currencySymbol }} {{ cart.membershipFee|number_format(2, ',', '.') }}</p>
  84.                                 {% endif %}
  85.                             {% endif %}
  86.                         {% endif %}
  87.                     </div>
  88.                     {# HAS APPLIED COUPON AND IS SUBSCRIPTION #}
  89.                     {% set isSubscription = cart.productOffer.product.type == enum('ProductEnum::SUBSCRIPTION')? true : false %}
  90.                     {% if cart.productCoupon and isSubscription %}
  91.                         {% set isAllLifetime = (cart.productOffer.planLifetime == 1 and cart.productCoupon.planLifetime == 1)? true:false %}
  92.                         {% if isAllLifetime == false %}
  93.                             <div class="coupon modal-coupon-charge js--open-modal-coupons-charge-cart{{ (cart.productCoupon is not empty and hasAvaliablePublicCoupons)? ' status--added' }}"
  94.                                 data-url="{{ path('listCouponChargeByProductOffers', { cartId: cart.id }) }}"
  95.                             >
  96.                         {% elseif hasAvaliablePublicCoupons %}
  97.                             <div class="coupon modal-coupon js--open-modal-coupons-cart{{ (cart.productCoupon is not empty)? ' status--added' }}"
  98.                                 data-url="{{ path('listCouponByProductOffers', { productOfferId: cart.productOffer.id }) }}"
  99.                                 data-coupon-id="{{ (cart.productCoupon.id is defined)? cart.productCoupon.id }}"
  100.                                 data-cart-id="{{ cart.id }}"
  101.                             >
  102.                         {# ADDED PRIVATE COUPON #}
  103.                         {% elseif cart.productCoupon.public == 0 %}
  104.                             <div class="coupon status--added">
  105.                         {% endif %}
  106.                     {% elseif hasAvaliablePublicCoupons %}
  107.                         <div class="coupon modal-coupon js--open-modal-coupons-cart{{ (cart.productCoupon is not empty)? ' status--added' }}"
  108.                             data-url="{{ path('listCouponByProductOffers', { productOfferId: cart.productOffer.id }) }}"
  109.                             data-coupon-id="{{ (cart.productCoupon.id is defined)? cart.productCoupon.id }}"
  110.                             data-cart-id="{{ cart.id }}">
  111.                     {# ADDED PRIVATE COUPON #}
  112.                     {% elseif cart.productCoupon and cart.productCoupon.public == 0 %}
  113.                         <div class="coupon status--added">
  114.                     {% else %}
  115.                         <div class="coupon">
  116.                     {% endif %}
  117.                         {# LABEL #}
  118.                         {% if (hasAvaliablePublicCoupons) or (cart.productCoupon and cart.productCoupon.public == 0) %}
  119.                             <span class="ico">{{ ico('ticket') }}</span>
  120.                             <div class="key-coupon">                            
  121.                                 <small>{{ getLanguage('coupon', 'cart') }}</small>
  122.                                 {# ADDED COUPON #}
  123.                                 {% if cart.productCoupon is not empty %}
  124.                                     <p class="coupon-key">
  125.                                         {{ cart.productCoupon.key }}&ensp;
  126.                                         {% if cart.productCoupon.discountType == enum('ProductCouponEnum::CURRENCY') %}
  127.                                             -{{ cart.productOffer.currencySymbol }}&nbsp;{{ cart.productCoupon.discount|number_format(2, ',', '.') }}
  128.                                         {% elseif cart.productCoupon.discountType == enum('ProductCouponEnum::PERCENTAGE') %}
  129.                                             {{ cart.productCoupon.discount|number_format(2, ',', '.') }}&thinsp;% {{ getLanguage('discount', 'cart') }}
  130.                                         {% endif %}
  131.                                     </p>
  132.                                 {# NUMBER OF COUPONS #}
  133.                                 {% elseif hasAvaliablePublicCoupons %}
  134.                                     <p class="coupon-key">
  135.                                         {% set plural = (cart.productOfferCouponTotal == 1) ? 'avaliable' : 'avaliable_plural' %}
  136.                                         {{ cart.productOfferCouponTotal }} {{ getLanguage(plural, 'cart') }}
  137.                                     </p>
  138.                                 {% endif %}
  139.                             </div>
  140.                         {% endif %}
  141.                     </div>{# -/.coupon #}
  142.                 </div>
  143.                 {% if isCart %}
  144.                     <div class="box-actions">
  145.                         <button
  146.                             data-route="{{ path('cartDelete', { id: cart.id, isAjaxRequest: true }) }}"
  147.                             data-id="{{ cart.id }}"
  148.                             class="js--cart-delete"
  149.                             data-tooltip-text="{{ getLanguage('delete_item', 'cart') }}"
  150.                             data-tooltip-class="tooltip-base">
  151.                                 <i class="ico-delete far fa-times-circle"></i>
  152.                                 <i class="loader">{{ ico('loader-wish') }}</i>
  153.                         </button>
  154.                     </div>
  155.                 {% endif %}
  156.             </div>
  157.         {% endfor %}
  158.     </div>
  159.     {# DISCOUNT FORM #}
  160.     <div class="discount cart-box">
  161.         {% if isModuleActive('product_coupon_module') %}
  162.             
  163.             {% if isCart %}
  164.                 <form class="coupom js--coupom-form" action="{{ path('applyCartCoupon') }}" method="post" novalidate>
  165.                     <div class="input-wrap">
  166.                         <label class="ico" for="product-coupom">{{ ico('ticket') }}</label>
  167.                         <input type="text" name="couponKey" id="product-coupom" placeholder="{{ getLanguage('coupon_code', 'cart') }}" required>
  168.                         <button type="submit">OK</button>
  169.                     </div>
  170.                 </form>
  171.             {% else %}
  172.                 <form class="coupom js--coupom-form refresh" method="get" novalidate>
  173.                     <div class="input-wrap">
  174.                         <label class="ico" for="product-coupom">{{ ico('ticket') }}</label>
  175.                         <input type="text" name="couponKey" id="product-coupom" placeholder="{{ getLanguage('coupon_code', 'cart') }}" required>
  176.                         <button type="submit">OK</button>
  177.                     </div>
  178.                 </form>
  179.             {% endif %}
  180.             {% if showDiscount %}
  181.                 <div class="calc" data-show="{{ showDiscount }}">
  182.                     <p class="subtit">{{ getLanguage('without_discount', 'cart') }}</p>
  183.                     <p class="value label-discount">
  184.                         {{ getConfig('currency_symbol') }} <span id="list-full">{{ cartDisplaySubtotal|number_format(2, ',', '.') }}</span>
  185.                     </p>
  186.                 </div>
  187.                 <div class="calc" data-show="{{ showDiscount }}">
  188.                     <p class="subtit">{{ getLanguage('total_discount', 'cart') }}</p>
  189.                     <p class="value label-discount">
  190.                         {{ (cartSubtotalDiff > 0) ? '-' }}{{ getConfig('currency_symbol') }} <span id="list-discount">{{ cartSubtotalDiff|number_format(2, ',', '.') }}</span>
  191.                     </p>
  192.                 </div>
  193.             {% endif %}
  194.         {% endif %}
  195.         <div>
  196.             <p class="total">
  197.                 TOTAL {{ getConfig('currency_symbol') }}&nbsp;
  198.                 <b id="list-total">{{ cartSubtotal|number_format(2, ',', '.') }}</b>
  199.             </p>
  200.         </div>
  201.     </div>
  202.     {# ACTIONS #}
  203.     <div class="base-actions">
  204.         {% if isCart %}
  205.             <a href="{{ path('productListCourses', { type: "courses" }) }}">{{ getLanguage('kepp_buying', 'cart') }}</a>
  206.         {% endif %}
  207.         <button
  208.             id="btn-cart-finish"
  209.             type="button"
  210.             data-initiate="{{ path('cartInitiateCheckout') }}"
  211.             data-step="{{ user ? showInfoStep ? '#cart-step-info' : hasContracts ? '#cart-step-contract' : '#cart-step-payment' : '#cart-step-login' }}"
  212.             class="btn-confirmar"
  213.         >{{ getLanguage('finish', 'cart') }}</button>
  214.     </div>
  215. </div>