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

Open in your IDE?
  1. {% set hasCategory = false %}
  2. {% set request_uri = app.request.server.get('REQUEST_URI') %}
  3. {% if 'name=' in request_uri %}
  4.     {% set hasCategory = false %}
  5.     {% set RootCategory = "" %}
  6. {% elseif 'name=' in request_uri and Category != "" %}
  7.     {% set hasCategory = true %}
  8.     {% set RootCategory = Category.RootCategory %}
  9. {% elseif Category != "" %}
  10.     {% set hasCategory = true %}
  11.     {% set RootCategory = Category.RootCategory %}
  12. {% else %}
  13.     {% set hasCategory = false %}
  14.     {% set RootCategory = "" %}
  15. {% endif %}
  16. {% if Category != "" %}
  17.     {% block javascript %}
  18.     
  19.     <script>
  20.     $(function() {
  21.         {% if RootCategory == "買い取り" or 'id=217' in request_uri or 'id=218' in request_uri%}
  22.                 $('.cat_mob_top-content-box').css('background-color','#22b573');
  23.                 $('.mob_top-content-box').css('background-color','#22b573');
  24.         {% endif %}
  25.     });
  26.     </script>
  27.     
  28.     {% endblock %}
  29.     
  30.     
  31.     {% set RootCategory = Category.RootCategory %}
  32.     {% if RootCategory == '新入荷' or RootCategory ==  "おすすめ商品" %}
  33.         <div class="mob-topnav">
  34.             <div class="title-box">
  35.                 <a href="{{url('homepage')}}products/list?category_id=7" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/poke.png') }}" alt=""></a>
  36.                 <div class="sbbtn-box">
  37.                     <div class="salebtn">
  38.                         <div>
  39.                             <a href="{{url('homepage')}}products/list?category_id=7">買う</a>
  40.                         </div>
  41.                     </div>
  42.                     <div class="buybtn">
  43.                         <div>
  44.                             <a href="{{url('homepage')}}products/list?category_id=219">売る</a>
  45.                         </div>
  46.                     </div>
  47.                 </div>
  48.             </div>
  49.             <div class="title-box">
  50.                 <a href="{{url('homepage')}}products/list?category_id=8" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/weis.png') }}" alt=""></a>
  51.                 <div class="sbbtn-box">
  52.                     <div class="salebtn">
  53.                         <div>
  54.                             <a href="{{url('homepage')}}products/list?category_id=8">買う</a>
  55.                         </div>
  56.                     </div>
  57.                     <div class="buybtn">
  58.                         <div>
  59.                             <a href="{{url('homepage')}}products/list?category_id=218">売る</a>
  60.                         </div>
  61.                     </div>
  62.                 </div>
  63.             </div>
  64.             
  65.         </div>
  66.         <div class="mob-topnsearch">
  67.             {{ render(path('block_side_serch')) }}
  68.         </div>
  69.  
  70.     
  71.     {% elseif RootCategory == '販売' %}
  72.        <!--現在のカテゴリID取得-->
  73.         {% set now_id = app.request.query.get('category_id') %}
  74.         <!--買い取り配下のカテゴリ取得-->
  75.         {% set cate_childs = RootCategory.getDescendants %}
  76.         <!--ルート表示-->
  77.         <!-- 現在カテゴリーから、親カテゴリに遡り「買い取り>ポケモンまで遡りたい」 -->
  78.         <!--現在カテゴリの上のカテゴリを取得 -->
  79.         {% set nowparent = Category.getParent() %}
  80.         {% set h = Category.hierarchy - 1 %}
  81.         <!--孫カテゴリ時に子カテゴリが表示された場合は親カテゴリへ -->
  82.         {% if nowparent == "シュヴァルツサイド" or nowparent == "ヴァイスサイド" %}
  83.         {% set nowparent = "ヴァイスシュヴァルツ" %}
  84.         {% endif %}
  85.         {% for cate in cate_childs %}
  86.             {% if h == cate.hierarchy %}
  87.             {# cate.name #}
  88.             {% endif %}
  89.         {% endfor %}
  90.             {% if nowparent == "ポケモン" or Category == "ポケモン" %}
  91.                 {% set cnt = 7 %}
  92.             
  93.                 {{ render(path('block_side_serch')) }}
  94.             
  95.             
  96.                 {# set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 7}) #}
  97.                 {% set Categories = repository('Eccube\\Entity\\Category').findByParentSorted(7) %}
  98.             
  99.             
  100.                 {# @see https://github.com/bolt/bolt/pull/2388 #}
  101.                 {% from _self import tree %}
  102.             
  103.             
  104.             
  105.                 <div class="side-cat1">
  106.                     <div class="side-cat-smallbox">
  107.                         <a href="{{url('homepage')}}products/list?category_id=7">ポケモン</a>
  108.                         <ul>
  109.                         {% for Category in Categories %}
  110.                             <li>{{ tree(Category) }}</li>
  111.                         {% endfor %}
  112.                         </ul>
  113.                     </div>
  114.                 </div>
  115.             {% elseif nowparent == "ヴァイスシュヴァルツ" or Category == "ヴァイスシュヴァルツ" %}
  116.                 {% set cnt = 7 %}
  117.             
  118.                 {{ render(path('block_side_serch')) }}
  119.             
  120.             
  121.                 {# set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 9}) #}
  122.                 {% set Categories = repository('Eccube\\Entity\\Category').findByParentSorted(9) %}
  123.             
  124.             
  125.                 {# @see https://github.com/bolt/bolt/pull/2388 #}
  126.                 {% from _self import tree %}
  127.             
  128.             
  129.             
  130.                 <div class="side-cat1">
  131.                     <div class="side-cat-smallbox">
  132.                         <a href="{{url('homepage')}}products/list?category_id=9">シュヴァルツサイド</a>
  133.                         <ul>
  134.                         {% for Category in Categories %}
  135.                             <li>{{ tree(Category) }}</li>
  136.                         {% endfor %}
  137.                         </ul>
  138.                     </div>
  139.                 </div>
  140.             
  141.             
  142.                 {# set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 10}) #}
  143.                 {% set Categories = repository('Eccube\\Entity\\Category').findByParentSorted(10) %}
  144.                 {# @see https://github.com/bolt/bolt/pull/2388 #}
  145.                 {% from _self import tree %}
  146.             
  147.                 <div class="side-cat1">
  148.                     <div class="side-cat-smallbox">
  149.                         <a href="{{url('homepage')}}products/list?category_id=10">ヴァイスサイド</a>
  150.                         <ul>
  151.                         {% for Category in Categories %}
  152.                             <li>{{ tree(Category) }}</li>
  153.                         {% endfor %}
  154.                         </ul>
  155.                     </div>
  156.                 </div>
  157.             
  158.             {% else %}
  159.                 <div class="mob-topnav">
  160.                     <div class="title-box">
  161.                         <a href="{{url('homepage')}}products/list?category_id=7" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/poke.png') }}" alt=""></a>
  162.                         <div class="sbbtn-box">
  163.                             <div class="salebtn">
  164.                                 <div>
  165.                                     <a href="{{url('homepage')}}products/list?category_id=7">買う</a>
  166.                                 </div>
  167.                             </div>
  168.                             <div class="buybtn">
  169.                                 <div>
  170.                                     <a href="{{url('homepage')}}products/list?category_id=219">売る</a>
  171.                                 </div>
  172.                             </div>
  173.                         </div>
  174.                     </div>
  175.                     <div class="title-box">
  176.                         <a href="{{url('homepage')}}products/list?category_id=8" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/weis.png') }}" alt=""></a>
  177.                         <div class="sbbtn-box">
  178.                             <div class="salebtn">
  179.                                 <div>
  180.                                     <a href="{{url('homepage')}}products/list?category_id=8">買う</a>
  181.                                 </div>
  182.                             </div>
  183.                             <div class="buybtn">
  184.                                 <div>
  185.                                     <a href="{{url('homepage')}}products/list?category_id=218">売る</a>
  186.                                 </div>
  187.                             </div>
  188.                         </div>
  189.                     </div>
  190.                     
  191.                 </div>
  192.                 <div class="mob-topnsearch">
  193.                     {{ render(path('block_side_serch')) }}
  194.                 </div>
  195.  
  196.             {% endif %}
  197.     
  198.     {% elseif  RootCategory == '買い取り' %}
  199.         <!--現在のカテゴリID取得-->
  200.         {% set now_id = app.request.query.get('category_id') %}
  201.         <!--買い取り配下のカテゴリ取得-->
  202.         {% set cate_childs = RootCategory.getDescendants %}
  203.         <!--ルート表示-->
  204.         <!-- 現在カテゴリーから、親カテゴリに遡り「買い取り>ポケモンまで遡りたい」 -->
  205.         <!--現在カテゴリの上のカテゴリを取得 -->
  206.         {% set nowparent = Category.getParent() %}
  207.         {% set h = Category.hierarchy - 1 %}
  208.         <!--孫カテゴリ時に子カテゴリが表示された場合は親カテゴリへ -->
  209.         {% if nowparent == "シュヴァルツサイド" or nowparent == "ヴァイスサイド" %}
  210.         {% set nowparent = "ヴァイスシュヴァルツ" %}
  211.         {% endif %}
  212.         {% for cate in cate_childs %}
  213.             {% if h == cate.hierarchy %}
  214.             {# cate.name #}
  215.             {% endif %}
  216.         {% endfor %}
  217.             {% if nowparent == "ポケモン" or Category == "ポケモン" %}
  218.                 {% set cnt = 7 %}
  219.             
  220.                 {{ render(path('block_side_serch_buy')) }}
  221.                 {# set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 219}) #}
  222.                 {% set Categories = repository('Eccube\\Entity\\Category').findByParentSorted(219) %}
  223.         
  224.                 {# @see https://github.com/bolt/bolt/pull/2388 #}
  225.                 {% from _self import tree %}
  226.             
  227.                 <div class="side-cat1">
  228.                     <div class="side-cat-smallbox">
  229.                         <a href="{{url('homepage')}}products/list?category_id=7">ポケモン</a>
  230.                         <ul>
  231.                         {% for Category in Categories %}
  232.                             <li>{{ tree(Category) }}</li>
  233.                         {% endfor %}
  234.                         </ul>
  235.                     </div>
  236.                 </div>
  237.  
  238.             {% elseif nowparent == "ヴァイスシュヴァルツ" or Category == "ヴァイスシュヴァルツ" %}
  239.                 {% set cnt = 7 %}
  240.             
  241.                 {{ render(path('block_side_serch_buy')) }}
  242.             
  243.             
  244.                 {# set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 221}) #}
  245.                 {% set Categories = repository('Eccube\\Entity\\Category').findByParentSorted(221) %}
  246.             
  247.             
  248.                 {# @see https://github.com/bolt/bolt/pull/2388 #}
  249.                 {% from _self import tree %}
  250.             
  251.             
  252.             
  253.                 <div class="side-cat1">
  254.                     <div class="side-cat-smallbox">
  255.                         <a href="{{url('homepage')}}products/list?category_id=9">シュヴァルツサイド</a>
  256.                         <ul>
  257.                         {% for Category in Categories %}
  258.                             <li>{{ tree(Category) }}</li>
  259.                         {% endfor %}
  260.                         </ul>
  261.                     </div>
  262.                 </div>
  263.             
  264.             
  265.                 {# set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 220}) #}
  266.                 {% set Categories = repository('Eccube\\Entity\\Category').findByParentSorted(220) %}
  267.                 {# @see https://github.com/bolt/bolt/pull/2388 #}
  268.                 {% from _self import tree %}
  269.             
  270.                 <div class="side-cat1">
  271.                     <div class="side-cat-smallbox">
  272.                         <a href="{{url('homepage')}}products/list?category_id=10">ヴァイスサイド</a>
  273.                         <ul>
  274.                         {% for Category in Categories %}
  275.                             <li>{{ tree(Category) }}</li>
  276.                         {% endfor %}
  277.                         </ul>
  278.                     </div>
  279.                 </div>
  280.             
  281.                 {% macro tree(Category) %}
  282.                     {% from _self import tree %}
  283.             
  284.                         <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  285.                             {{ Category.name }}
  286.                         </a>
  287.                         {% if Category.children|length > 0 %}
  288.                             <ul>
  289.                                 {% for ChildCategory in Category.children %}
  290.                                     <li>
  291.                                         {{ tree(ChildCategory) }}
  292.                                     </li>
  293.                                 {% endfor %}
  294.                             </ul>
  295.                         {% endif %}
  296.             
  297.                 {% endmacro %}
  298.             {% else %}
  299.                   <div class="mob-topnav">
  300.                     <div class="title-box">
  301.                         <a href="{{url('homepage')}}products/list?category_id=7" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/poke.png') }}" alt=""></a>
  302.                         <div class="sbbtn-box">
  303.                             <div class="salebtn">
  304.                                 <div>
  305.                                     <a href="{{url('homepage')}}products/list?category_id=7">買う</a>
  306.                                 </div>
  307.                             </div>
  308.                             <div class="buybtn">
  309.                                 <div>
  310.                                     <a href="{{url('homepage')}}products/list?category_id=219">売る</a>
  311.                                 </div>
  312.                             </div>
  313.                         </div>
  314.                     </div>
  315.                     <div class="title-box">
  316.                         <a href="{{url('homepage')}}products/list?category_id=8" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/weis.png') }}" alt=""></a>
  317.                         <div class="sbbtn-box">
  318.                             <div class="salebtn">
  319.                                 <div>
  320.                                     <a href="{{url('homepage')}}products/list?category_id=8">買う</a>
  321.                                 </div>
  322.                             </div>
  323.                             <div class="buybtn">
  324.                                 <div>
  325.                                     <a href="{{url('homepage')}}products/list?category_id=218">売る</a>
  326.                                 </div>
  327.                             </div>
  328.                         </div>
  329.                     </div>
  330.                     
  331.                 </div>
  332.                 <div class="mob-topnsearch">
  333.                 {{ render(path('block_side_serch_buy')) }}
  334.                 </div>
  335.             {% endif %}
  336.     {% else %}
  337.                  <div class="mob-topnav">
  338.                     <div class="title-box">
  339.                         <a href="{{url('homepage')}}products/list?category_id=7" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/poke.png') }}" alt=""></a>
  340.                         <div class="sbbtn-box">
  341.                             <div class="salebtn">
  342.                                 <div>
  343.                                     <a href="{{url('homepage')}}products/list?category_id=7">買う</a>
  344.                                 </div>
  345.                             </div>
  346.                             <div class="buybtn">
  347.                                 <div>
  348.                                     <a href="{{url('homepage')}}products/list?category_id=219">売る</a>
  349.                                 </div>
  350.                             </div>
  351.                         </div>
  352.                     </div>
  353.                     <div class="title-box">
  354.                         <a href="{{url('homepage')}}products/list?category_id=8" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/weis.png') }}" alt=""></a>
  355.                         <div class="sbbtn-box">
  356.                             <div class="salebtn">
  357.                                 <div>
  358.                                     <a href="{{url('homepage')}}products/list?category_id=8">買う</a>
  359.                                 </div>
  360.                             </div>
  361.                             <div class="buybtn">
  362.                                 <div>
  363.                                     <a href="{{url('homepage')}}products/list?category_id=218">売る</a>
  364.                                 </div>
  365.                             </div>
  366.                         </div>
  367.                     </div>
  368.                     
  369.                 </div>
  370.                 <div class="mob-topnsearch">
  371.                 {{ render(path('block_side_serch_buy')) }}
  372.                 </div>
  373.     {% endif %}
  374. {% else %}
  375.                <div class="mob-topnav">
  376.                     <div class="title-box">
  377.                         <a href="{{url('homepage')}}products/list?category_id=7" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/poke.png') }}" alt=""></a>
  378.                         <div class="sbbtn-box">
  379.                             <div class="salebtn">
  380.                                 <div>
  381.                                     <a href="{{url('homepage')}}products/list?category_id=7">買う</a>
  382.                                 </div>
  383.                             </div>
  384.                             <div class="buybtn">
  385.                                 <div>
  386.                                     <a href="{{url('homepage')}}products/list?category_id=219">売る</a>
  387.                                 </div>
  388.                             </div>
  389.                         </div>
  390.                     </div>
  391.                     <div class="title-box">
  392.                         <a href="{{url('homepage')}}products/list?category_id=8" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/weis.png') }}" alt=""></a>
  393.                         <div class="sbbtn-box">
  394.                             <div class="salebtn">
  395.                                 <div>
  396.                                     <a href="{{url('homepage')}}products/list?category_id=8">買う</a>
  397.                                 </div>
  398.                             </div>
  399.                             <div class="buybtn">
  400.                                 <div>
  401.                                     <a href="{{url('homepage')}}products/list?category_id=218">売る</a>
  402.                                 </div>
  403.                             </div>
  404.                         </div>
  405.                     </div>
  406.                     
  407.                 </div>
  408.                 <div class="mob-topnsearch">
  409.                     {{ render(path('block_side_serch')) }}
  410.                 </div>
  411. {% endif %}
  412.                 {% macro tree(Category) %}
  413.                     {% from _self import tree %}
  414.             
  415.                         <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  416.                             {{ Category.name }}
  417.                         </a>
  418.                         {% if Category.children|length > 0 %}
  419.                             <ul>
  420.                                 {% for ChildCategory in Category.children %}
  421.                                     <li>
  422.                                         {{ tree(ChildCategory) }}
  423.                                     </li>
  424.                                 {% endfor %}
  425.                             </ul>
  426.                         {% endif %}
  427.             
  428.                 {% endmacro %}