app/Plugin/Gift42/Resource/template/front/Cart/index.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of the Gift42 Plugin
  3. Copyright (C) 2023 Diezon.
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {% block stylesheet %}
  8.     <style>
  9.         .ec-cartRow__summary .gift-type-text {
  10.             font-size: 12px;
  11.             margin-bottom: 4px;
  12.         }
  13.         .ec-blockBtn--gift {
  14.             margin-bottom: 10px;
  15.         }
  16.         .ec-blockBtn--gift .is-inactive {
  17.             pointer-events: none;
  18.             background: rgba(72, 72, 87, 0.2);
  19.             border: none;
  20.         }
  21.         .ec-blockBtn--gift p {
  22.             font-size: 14px;
  23.             text-align: center;
  24.             margin-top: 4px;
  25.         }
  26.         .gift-card-note {
  27.             font-size: 12px;
  28.             margin-top: 5px;
  29.         }
  30.         @media only screen and (min-width: 768px){
  31.             .ec-cartRole__error--cart .ec-alert-warning {
  32.                 max-width: 100% !important;
  33.             }
  34.             .ec-cartRole__error--cart .ec-alert-warning__icon img {
  35.                 display: block;
  36.             }
  37.             .gift-card-note {
  38.                 font-size: 14px;
  39.             }
  40.         }
  41.     </style>
  42. {% endblock %}
  43. {% block javascript %}
  44.     <script>
  45.         $(function () {
  46.             {% if totalQuantity > 0 %}
  47.                 {% for CartIndex,Cart in Carts %}
  48.                         var targetButton = $('a.ec-blockBtn--action[href*="/cart/buystep/{{ Cart.cart_key }}"]');
  49.                         var insertButton = $("#ec-blockBtn--gift_{{ Cart.cart_key }}");
  50.                         $(insertButton).insertBefore(targetButton);
  51.                     {% for CartItem in Cart.CartItems %}
  52.                         {% set ProductClass = CartItem.ProductClass %}
  53.                         {% set Product = CartItem.ProductClass.Product %}
  54.                         {% if isGiftOptionProduct(Product) %}
  55.                             const cartRowAmountUpDown{{ ProductClass.id }} = $('div.ec-cartRow__amountUpDown:has(a[href*="{{ url('cart_handle_item', {'operation': 'up', 'productClassId': ProductClass.id}) }}"])');
  56.                             $(cartRowAmountUpDown{{ ProductClass.id }}).hide();
  57.                             var targetRow = $('a[href*="{{ url('product_detail', {id : Product.id} ) }}"]').closest('.ec-cartRow__name');
  58.                             var insertRow = '<p class="gift-type-text">{{ getGiftKindName(Product) }}</p>';
  59.                             $(insertRow).insertBefore(targetRow);
  60.                         {% endif %}
  61.                         {% if isMessageCardProduct(Product) %}
  62.                             var targetRow = $('a[href*="{{ url('product_detail', {id : Product.id} ) }}"]').closest('.ec-cartRow__name').next();
  63.                             var insertRow = '<p class="gift-card-note">{{ 'front.cart.message_card.description'|trans }}</p>';
  64.                             $(insertRow).insertAfter(targetRow);
  65.                         {% endif %}
  66.                     {% endfor %}
  67.                 {% endfor %}
  68.             {% endif %}
  69.         });
  70.     </script>
  71. {% endblock javascript %}
  72. {% block main %}
  73.     {% if totalQuantity > 0 %}
  74.         {% for CartIndex,Cart in Carts %}
  75.             {% set hasGiftDisableProduct = constant('Eccube\\Common\\Constant::DISABLED') %}
  76.             {% for CartItem in Cart.CartItems %}
  77.                 {% set Product = CartItem.ProductClass.Product %}
  78.                 {% if isGiftDisableProduct(Product) %}
  79.                     {% set hasGiftDisableProduct = constant('Eccube\\Common\\Constant::ENABLED') %}
  80.                 {% endif %}
  81.             {% endfor %}
  82.             {% set saleTypeId = Cart.CartKey|split('_')[1] %}{# @note : カートキーは、"会員ID_販売種別ID" or "乱数_販売種別ID"で構成されている。#}
  83.             {% if getGiftProducts(saleTypeId) %}
  84.                 <div class="ec-blockBtn--gift" id="ec-blockBtn--gift_{{ Cart.cart_key }}">
  85.                     <a class="ec-blockBtn--cancel {% if hasGiftDisableProduct or is_granted('ROLE_USER') == false %}is-inactive{% endif %}" href="{{ url('gift_config', { id: Cart.id }) }}">{{ 'front.gift_config'|trans }}</a>
  86.                     {% if is_granted('ROLE_USER') == false %}
  87.                         <p>{{ 'front.cart.gift_service_is_member_only'|trans }}</p>
  88.                     {% elseif hasGiftDisableProduct %}
  89.                         <p>{{ 'front.cart.includes_products_cannot_be_gifted'|trans }}</p>
  90.                     {% endif %}
  91.                 </div>
  92.             {% endif %}
  93.         {% endfor %}
  94.     {% endif %}
  95. {% endblock %}