app/template/default/Block/header1.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% block stylesheet %}
  9.     {#<link rel="stylesheet" href="{{ asset('assets/css/main_module.css', 'user_data') }}">#}
  10.     {#<link rel="stylesheet" href="{{ asset('assets/css/header_style.css', 'user_data') }}">#}
  11.     <link rel="stylesheet" href="{{ asset('assets/css/page/header_stock_photo.css', 'user_data') }}">
  12. {% endblock %}
  13. {% block javascript %}
  14.     <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  15.     <script src="{{ asset('assets/js/header.js', 'user_data') }}"></script>
  16.     
  17.     <script>
  18.         document.addEventListener('DOMContentLoaded', function() {
  19.             if (window.innerWidth <= 768) {  // スマホサイズ判定
  20.                 const navLinks = document.querySelectorAll('.ec-categoryNaviRole .ec-itemNav__nav > li > a');
  21.         
  22.                 navLinks.forEach(function(link) {
  23.                     link.addEventListener('click', function(e) {
  24.                         // もし親liに「開くためのイベント」が登録されてるなら、それだけ止める
  25.                         e.stopPropagation(); // 親要素への伝播を止める(クリックイベントが親に届かない)
  26.                         // e.preventDefault() は書かない → これを書かないから「リンク移動はする」!!
  27.                     });
  28.                 });
  29.             }
  30.         });
  31.     </script>
  32.     
  33. {% endblock  %}
  34. <div class="fixed-header">
  35.     <section>
  36.     <div id="site_header">
  37.         <div class="header_logo">
  38.             <a href="{{url('books')}}">
  39.                 <img src="{{ asset('assets/img/common/photopub_title.svg', 'user_data') }}">
  40.             </a>
  41.         </div>
  42.         <div class="header_menus">
  43.             <div class="header_inner1">
  44.                 {#{{ render(path('block_search_product')) }}#}
  45.                 <div class="ec-headerSearch">
  46.                     <form method="get" class="search-form pc" action="{{ path('product_list') }}">
  47.                         <input type="search" name="name" maxlength="50" class="search-form-input" placeholder="キーワード(タイトル、著者など)を入力">
  48.                         <button type="submit" class="search-form-submit" aria-label="検索"></button>
  49.                     </form>
  50.                 </div>
  51.                 <div class="header_link1 pc">
  52.                     <ul class="link1">
  53.                         <li><a href="https://photo-pub.co.jp/news">NEWS</a></li>
  54.                         <li><a href="https://photo-pub.co.jp/company">会社概要</a></li>
  55.                         <li><a href="{{ url('contact') }}">お問い合わせ</a></li>
  56.                         <li><a href="{{ url('opinion') }}">意見箱</a></li>
  57.                     </ul>
  58.                 </div>
  59.                 <div class="header_link2">
  60.                     {{ include('Block/login.twig', {parent_template: 'header1.twig'}) }}
  61.                 </div>
  62.                 <div class="hamburger-menu sp">
  63.                     <button id="hamburger" class="hamburger">
  64.                         <span></span>
  65.                         <span></span>
  66.                         <span></span>
  67.                     </button>
  68.                     <nav id="menus" class="menus">
  69.                         <ul class="hamburger-tabs">
  70.                             <li class="menu-item">
  71.                                 <a href="{{ url('homepage') }}">TOP</a>
  72.                             </li>
  73.                             <li class="menu-item">
  74.                                 <a href="{{ url('homepage') }}">フォトパブ堂書店</a>
  75.                                 <ul class="submenu">
  76.                                     {% set AllCategories = repository('Eccube\\Entity\\Category').getList() %}
  77.                                     {% set Categories = AllCategories|filter(c => c.id is not null and c.id == 1) %}
  78.                                     {% for Category in Categories %}
  79.                                         {% for Child in Category.Children %}
  80.                                             <li>
  81.                                                 <span><a href="{{ url('product_list') }}?category_id={{ Child.id }}">{{ Child }}</a></span>
  82.                                             </li>
  83.                                         {% endfor %}
  84.                                     {% endfor %}
  85.                                 </ul>
  86.                             </li>
  87.                             <li class="menu-item">
  88.                                 <a href="{{ url('homepage') }}">フォトパブ写真館</a>
  89.                                 <ul class="submenu">
  90.                                     <li><span></span><a href="{{ url('homepage') }}photos">  フォトパブ写真館TOP</a></li>
  91.                                     {% set AllCategories = repository('Eccube\\Entity\\Category').getList() %}
  92.                                     {% set Categories = AllCategories|filter(c => c.id is not null and c.id == 6) %}
  93.                                     {% for Category in Categories %}
  94.                                         {% for Child in Category.Children %}
  95.                                             <li>
  96.                                                 <span><a href="{{ url('photo-product_list') }}?category_id={{ Child.id }}">{{ Child }}</a></span>
  97.                                             </li>
  98.                                         {% endfor %}
  99.                                     {% endfor %}
  100.                                 </ul>
  101.                             </li>
  102.                             <li class="menu-item">
  103.                                 <a href="https://jihi.photo-pub.co.jp/">自費出版サービス</a>
  104.                                 <ul class="submenu">
  105.                                     <li><span></span><a href="https://jihi.photo-pub.co.jp/">自費出版について</a></li>
  106.                                     <li><span></span><a href="https://jihi.photo-pub.co.jp/calc.php">自動見積もり</a></li>
  107.                                     <li><span></span><a href="https://jihi.photo-pub.co.jp/qanda.php">出版までの流れ</a></li>
  108.                                     <li><span></span><a href="https://jihi.photo-pub.co.jp/inquiry/">自費出版に関するご相談</a></li>
  109.                                 </ul>
  110.                             </li>
  111.                             <li class="menu-item">
  112.                                 <a href="https://photo-pub.co.jp/event">イベント情報</a>
  113.                                 <ul class="submenu">
  114.                                     <li><span></span><a href="https://photo-pub.co.jp/event">イベント一覧</a></li>
  115.                                 </ul>
  116.                             </li>
  117.                             <li class="menu-item">
  118.                                 <a href="https://photo-pub.co.jp/recruit">各種募集</a>
  119.                                 <ul class="submenu">
  120.                                     <li><span></span><a href="https://photo-pub.co.jp/recruit">募集一覧</a></li>
  121.                                 </ul>
  122.                             </li>
  123.                         </ul>
  124.                         <ul class="hamburger-links">
  125.                             <li><a href="https://photo-pub.co.jp/news">NEWS</a></li>
  126.                             <li><a href="https://photo-pub.co.jp/company">会社概要</a></li>
  127.                             <li><a href="{{ url('contact') }}">お問い合わせ</a></li>
  128.                             <li><a href="{{ url('opinion') }}">意見箱</a></li>
  129.                             <li><a href="{{url('help_privacy')}}">プライバシー<br class="br_linkbox">ポリシー</a></li>
  130.                             <li><a href="{{url('help_tradelaw')}}">特定商取引法<br class="br_linkbox">に基づく表記</a></li>
  131.                         </ul>
  132.                         <ul class="hamburger-sns">
  133.                             <li><a><img src="{{ asset('assets/img/common/sns_ic_insta.png', 'user_data') }}" alt="insta"></a></li>
  134.                             <li><a href="https://www.youtube.com/@%E3%83%95%E3%82%A9%E3%83%88%E3%83%91%E3%83%96"><img src="{{ asset('assets/img/common/sns_ic_youtube.svg', 'user_data') }}" alt="youtube"></a></li>
  135.                             <li><a href="https://twitter.com/share?url=https://photo-pub.co.jp/&via=photopub402&hashtags=%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%83%95%E3%82%A9%E3%83%88%E3%83%91%E3%83%96%E3%83%AA%E3%83%83%E3%82%B7%E3%83%B3%E3%82%B0&text=%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%83%95%E3%82%A9%E3%83%88%E3%83%91%E3%83%96%E3%83%AA%E3%83%83%E3%82%B7%E3%83%B3%E3%82%B0"><img src="{{ asset('assets/img/common/sns_ic_x.svg', 'user_data') }}" alt="x"></a></li>
  136.                             <li><a href="http://www.facebook.com/share.php?u=https://photo-pub.co.jp/"><img src="{{ asset('assets/img/common/sns_ic_fb.svg', 'user_data') }}" alt="fb"></a></li>
  137.                         </ul>
  138.                     </nav>
  139.                 </div>
  140.             </div>
  141.             <div class="header_inner2 pc">
  142.                 <ul class="select_btns">
  143.                     <li class="btn"><a href="{{ url('homepage') }}">TOP</a></li>
  144.                     <li class="btn"><a href="{{ url('homepage') }}books">フォトパブ堂書店</a></li>
  145.                     <li class="btn"><a href="{{ url('homepage') }}photos">フォトパブ写真館</a></li>
  146.                     <li class="btn"><a href="http://jihi.photo-pub.co.jp/">自費出版サービス</a></li>
  147.                     <li class="btn"><a href="https://photo-pub.co.jp/event">イベント情報</a></li>
  148.                     <li class="btn"><a href="https://photo-pub.co.jp/recruit">各種募集</a></li>
  149.                 </ul>
  150.             </div>
  151.         </div>
  152.     </div>
  153.     <div class="tabs">
  154.         <ul class="tabs_inner">
  155.             {% set AllCategories = repository('Eccube\\Entity\\Category').getList() %}
  156.             {% set Categories = AllCategories|filter(c => c.id is not null and c.id == 1) %}
  157.     
  158.             {% macro tree(Category, depth) %}
  159.                 {% from _self import tree %}
  160.     
  161.                 {% if depth == 1 %}
  162.                     <li>
  163.                         <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  164.                             {{ Category.name }}
  165.                         </a>
  166.                         {% if Category.children|length > 0 %}
  167.                             <ul>
  168.                                 {% for ChildCategory in Category.children %}
  169.                                     {{ tree(ChildCategory, depth + 1) }}
  170.                                 {% endfor %}
  171.                             </ul>
  172.                         {% endif %}
  173.                     </li>
  174.                 {% elseif depth == 2 %}
  175.                     <li>
  176.                         <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  177.                             {{ Category.name }}
  178.                         </a>
  179.                     </li>
  180.                 {% endif %}
  181.             {% endmacro %}
  182.     
  183.             {% from _self import tree %}
  184.     
  185.             <div class="ec-categoryNaviRole">
  186.                 <div class="ec-itemNav">
  187.                     <ul class="ec-itemNav__nav">
  188.                         {% for FirstCategory in Categories %}
  189.                             {% for SecondCategory in FirstCategory.children %}
  190.                                 {{ tree(SecondCategory, 1) }}
  191.                             {% endfor %}
  192.                         {% endfor %}
  193.                     </ul>
  194.                 </div>
  195.             </div>
  196.         </ul>
  197.     </div>
  198.     <div class="sp-search-form">
  199.         <form action="{{ path('product_list') }}" class="search-form sp">
  200.             <input type="search" name="name" maxlength="50" class="search-form-input" placeholder="キーワード(タイトル、著者など)を入力">
  201.             <button type="submit" class="search-form-submit" aria-label="検索"></button>
  202.         </form>
  203.     </div>
  204. </section>
  205. </div>
  206. <style>
  207.     .fixed-header {
  208.     position: fixed;
  209.     top: 0;
  210.     left: 0;
  211.     width: 100%;
  212.     z-index: 9999;
  213.     background-color: #fff; /* 背景が透けないように */
  214.     box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* 任意:影で浮かせる */
  215.     }
  216.     
  217.     body {
  218.         padding-top: 150px; /* ヘッダーの高さに合わせて調整(例:80px) */
  219.     }
  220. @media screen and (max-width: 820px) {
  221.     body {
  222.         padding-top: 180px; /* ヘッダーの高さに合わせて調整(例:80px) */
  223.     }
  224. }
  225. </style>