templates/uniqskills/catalogue/landing_new/landing_partials/promotionBar.html.twig line 1

Open in your IDE?
  1. {% set paymentModule = findModuleByType(landing.modules, 'payment') %}
  2. {% set productVariantsToDisplay = [] %}
  3. {% set couponParam = app.request.query.get('apicoupon') %}
  4. {% set discountCode = null %}
  5. {# Select product variants from paymentModule #}
  6. {% for landingProductVariant in paymentModule.subscriptions %}
  7.     {% for productVariant in productVariants %}
  8.         {% if productVariant.id == landingProductVariant.subscription %}
  9.             {% set productVariantsToDisplay = productVariantsToDisplay|merge([{
  10.                 'productVariant': productVariant,
  11.                 'landingProductVariant': landingProductVariant
  12.             }]) %}
  13.         {% endif %}
  14.     {% endfor %}
  15. {% endfor %}
  16. {# Find discount code if applicable #}
  17. {% for productVariantToDisplay in productVariantsToDisplay %}
  18.     {% if productVariantToDisplay['landingProductVariant'] is not empty %}
  19.         {% for subscriptionCoupon in productVariantToDisplay['productVariant'].coupon %}
  20.             {% if couponParam is not empty %}
  21.                 {% if subscriptionCoupon.code == couponParam and discountCode is empty %}
  22.                     {% set discountCode = subscriptionCoupon %}
  23.                 {% endif %}
  24.             {% elseif productVariantToDisplay['landingProductVariant'].discountCode is not empty %}
  25.                 {% if subscriptionCoupon.id == productVariantToDisplay['landingProductVariant'].discountCode and discountCode is empty %}
  26.                     {% set discountCode = subscriptionCoupon %}
  27.                 {% endif %}
  28.             {% endif %}
  29.         {% endfor %}
  30.     {% endif %}
  31. {% endfor %}
  32. {% set promotionIsActive = discountCode is not null and discountCode.dateTo|date("U") > "now"|date("U") and discountCode.isActive %}
  33. {% if not (promotionIsActive == false and module.hideSectionWhenPromotionEnds is defined and module.hideSectionWhenPromotionEnds == true) %}
  34. <section class="rowRabat"
  35.         {% if module.background is not empty %} style="background-color: {{ module.background|raw }}" {% endif %}
  36. >
  37.     <div class="container">
  38.         <div class="row">
  39.             <div class="col-12 rowRabat__rabat text-center"
  40.                     {% if module.textColor is defined and module.textColor is not empty %} style="color: {{ module.textColor|raw }}" {% endif %}
  41.             >
  42.                 {{ module.text|raw }}
  43.             </div>
  44.         </div>
  45.     </div>
  46. </section>
  47. {% endif %}