app/template/user_data/manual.twig line 1

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% set body_class = 'manual_page' %}
  3. {% block javascript %}
  4.     <script>
  5.         eccube.productsClassCategories = {
  6.             {% for Product in pagination %}
  7.             "{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
  8.             {% endfor %}
  9.         };
  10.         $(function() {
  11.             // 表示件数を変更
  12.             $('.disp-number').change(function() {
  13.                 var dispNumber = $(this).val();
  14.                 $('#disp_number').val(dispNumber);
  15.                 $('#pageno').val(1);
  16.                 $("#form1").submit();
  17.             });
  18.             // 並び順を変更
  19.             $('.order-by').change(function() {
  20.                 var orderBy = $(this).val();
  21.                 $('#orderby').val(orderBy);
  22.                 $('#pageno').val(1);
  23.                 $("#form1").submit();
  24.             });
  25.             $('.add-cart').on('click', function(e) {
  26.                 var $form = $(this).parents('li').find('form');
  27.                 // 個数フォームのチェック
  28.                 var $quantity = $form.parent().find('.quantity');
  29.                 if ($quantity.val() < 1) {
  30.                     $quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  31.                     setTimeout(function() {
  32.                         loadingOverlay('hide');
  33.                     }, 100);
  34.                     return true;
  35.                 } else {
  36.                     $quantity[0].setCustomValidity('');
  37.                 }
  38.                 e.preventDefault();
  39.                 $.ajax({
  40.                     url: $form.attr('action'),
  41.                     type: $form.attr('method'),
  42.                     data: $form.serialize(),
  43.                     dataType: 'json',
  44.                     beforeSend: function(xhr, settings) {
  45.                         // Buttonを無効にする
  46.                         $('.add-cart').prop('disabled', true);
  47.                     }
  48.                 }).done(function(data) {
  49.                     // レスポンス内のメッセージをalertで表示
  50.                     $.each(data.messages, function() {
  51.                         $('#ec-modal-header').html(this);
  52.                     });
  53.                     $('.ec-modal').show()
  54.                     // カートブロックを更新する
  55.                     $.ajax({
  56.                         url: '{{ url('block_cart') }}',
  57.                         type: 'GET',
  58.                         dataType: 'html'
  59.                     }).done(function(html) {
  60.                         $('.ec-headerRole__cart').html(html);
  61.                     });
  62.                 }).fail(function(data) {
  63.                     alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  64.                 }).always(function(data) {
  65.                     // Buttonを有効にする
  66.                     $('.add-cart').prop('disabled', false);
  67.                 });
  68.             });
  69.         });
  70.         $('.ec-modal-overlay, .ec-modal .ec-inlineBtn--cancel').on('click', function() {
  71.             $('.ec-modal').hide()
  72.         });
  73.     </script>
  74. {% endblock %}
  75. {% block main %}
  76.     {% if search_form.category_id.vars.errors|length > 0 %}
  77.         <div class="ec-searchnavRole">
  78.             <p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
  79.         </div>
  80.     {% else %}{# カテゴリー表示 #}
  81.         <div class="ak-header">
  82.             <div class="ak-pageHeader">
  83.                 <h1 style="text-align: center">MANUAL</h1>
  84.             </div>
  85. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  86.         </div><!-- ak-header -->
  87. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  88. {% macro tree(Category , pagination ,forms) %}
  89.     {% from _self import tree %}
  90.                 {# <h2><a href="{{ url('product_list') }}?category_id={{ Category.id }}">{{ Category.name }}</a></h2> #}
  91.                 <h2>{{ Category.name }}</h2>
  92.     {# 商品情報 #}
  93.     {% if pagination.totalItemCount > 0 %}
  94.             <div class="ec-shelfRole">
  95.                 <ul class="ec-shelfGrid">
  96.                     {% for Product in pagination %}
  97.                         {% if Product.manual_url is not empty %}                    
  98.                         {% set CategoryItemName = "" %}
  99.                             {# 関連カテゴリ #}
  100.                             {% if Product.ProductCategories is not empty %}
  101.                                 {% for ProductCategory in Product.ProductCategories %}
  102.                                 
  103.                                     {% for CategoryItem in ProductCategory.Category.path %}
  104.                                         {% set CategoryItemName = CategoryItem.name %}
  105.                                     {% endfor %}
  106.                                     {% if Category.name == CategoryItemName %}
  107.                                     {% if is_granted('ROLE_USER') or Product.member != 1 %}{# 会員限定 #}
  108.                                     <li class="ec-shelfGrid__item">
  109.                                         {#<p>{{Category.name}}:{{CategoryItemName}}</p>#}
  110.                                             <h3>{{ Product.name }}</h3>
  111.                                             <div class='manual-button__warp'>
  112.                                                 <div class="ak-link">
  113.                                                     <a href="/html/upload/save_image/manualFile/{{ Product.manual_url }}" target="_blank">組み立てマニュアル</a>
  114.                                                 </div>
  115.                                             </div><!-- .product_desc -->
  116.                                     </li>
  117.                                     {% endif %}
  118.                                     {% endif %}{# 会員限定 #}
  119.                                 {% endfor %}
  120.                             {% endif %}
  121.                             {# 関連カテゴリ #}
  122.                         {% endif %}
  123.                     {% endfor %}
  124.                 </ul>
  125.             </div>
  126.     {% endif %}
  127.     {# 商品情報 #}
  128.     {% if Category.children|length > 0 %}
  129.             {% for ChildCategory in Category.children %}
  130.                 <div class="">
  131.                     {{ tree(Category , pagination ,forms) }}
  132.                 </div>
  133.             {% endfor %}
  134.     {% endif %}
  135. {% endmacro %}
  136.             <style>
  137.             
  138.             .manual_page .ak-link {
  139.                 padding: 14px 0 14px 0;
  140.              width: 100%;
  141.             }
  142.             .manual_page .ak-link a {
  143.                 display: inline-block;
  144.                 background-image: url(/html/template/akracing/assets/img/common/link_icon.png);
  145.                 background-position: right 15px center;
  146.                 background-repeat: no-repeat;
  147.                 padding: 10px 1em;
  148.                 border: 1px solid #fff;
  149.                 margin: 0 auto;
  150.                 width: 100%;
  151.                 text-align: center;
  152.             }
  153.                 #page_manual .ec-shelfGrid .ec-shelfGrid__item {
  154.                     width: 100%;
  155.                     display: flex;
  156.                     flex-wrap: wrap;
  157.                     justify-content: space-between;
  158.                     align-items: center;
  159.                     flex-direction: row;
  160.                 }
  161.                 #page_manual .ec-shelfGrid .ec-shelfGrid__item > *{
  162.                     width:45%;
  163.                     margin:0;
  164.                 }
  165.                 #page_manual .ec-shelfGrid__item h3{
  166.                     font-size:1.8rem;
  167.                 }
  168.                 #page_manual .ak-body h2 {
  169.                     font-size: 24px;
  170.                     padding: 0 0 0 1em;
  171.                     position: relative;
  172.                     width: 100%;
  173.                 }
  174.                 #page_manual .ak-body h2::before {
  175.                     position: absolute;
  176.                     content: "";
  177.                     color: #c60a1c;
  178.                     background-color: #c60a1c;
  179.                     width: .5em;
  180.                     height: 2px;
  181.                     top: .5em;
  182.                     left: 0;
  183.                 }
  184.                 @media (max-width: 1023px) {
  185.                     #page_manual .ec-shelfGrid .ec-shelfGrid__item {
  186.                         display:block;
  187.                     }
  188.                     #page_manual .ec-shelfGrid .ec-shelfGrid__item > *{
  189.                         width:100%;
  190.                     }
  191.                 
  192.                 }
  193.         </style>
  194. {# @see https://github.com/bolt/bolt/pull/2388 #}
  195. {% from _self import tree %}
  196. <div class="ak-body">
  197.     <div class="">
  198.             {% for Category in Categories|sort %}
  199.             
  200.             {% if pagination.params == null or pagination.params["category_id"] is not defined %}
  201.             {# 一覧表示 #}
  202.                     {{ tree(Category , pagination ,forms) }}
  203.             {% else %}
  204.             {# カテゴリー表示 #}
  205.                 {# dump( pagination.params["category_id"] ) #}
  206.                 {# dump(Category.id) #}
  207.                 {% set categoryId = pagination.params["category_id"] %}
  208.                 {% if categoryId == Category.id %}
  209.                     {{ tree(Category , pagination ,forms) }}
  210.                 {% endif %}
  211.             {% endif %}
  212.             {% endfor %}
  213.     </div>
  214. </div>
  215.         {% if pagination.totalItemCount > 0 %}
  216.             <div class="ec-modal">
  217.                 <div class="ec-modal-overlay">
  218.                     <div class="ec-modal-wrap">
  219.                         <span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt="" loading="lazy"/></span></span>
  220.                         <div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
  221.                         <div class="ec-modal-box">
  222.                             <div class="ec-role">
  223.                                 <span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
  224.                                 <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
  225.                             </div>
  226.                         </div>
  227.                     </div>
  228.                 </div>
  229.             </div>
  230.             <div class="ec-pagerRole">
  231.                 {% include "pager.twig" with {'pages': pagination.paginationData} %}
  232.             </div>
  233.         {% endif %}
  234.     {% endif %}{# カテゴリー表示 #}
  235. {% endblock %}