templates/block/speccatmenu.html.twig line 1

Open in your IDE?
  1. {% set supurl = '' %}
  2. {% if spec != '' %}
  3. {% set supurl = spec ~ '/' %}
  4. {% endif %}
  5. {% if speccatmenu_search %}
  6. {% set search = '?q=' ~ speccatmenu_search %}
  7. {% else %}
  8. {% set search = '' %}
  9. {% endif %}
  10. {% set menu = speccatmenu_menu %}
  11. {% set spec = speccatmenu_spec ?: 'default' %}
  12. {% set catpages = speccatmenu_catpages %}
  13. {% set parent_id = speccatmenu_parent_id %}
  14. {% set cat_id = speccatmenu_cat_id %}
  15. <ul class="desktop-menu">
  16.     {% for cat in menu[0] %}
  17.     {% if cat.prods or spec == 'default' or spec == '' %}
  18.     <li class="cat-active">
  19.         {% if spec == 'new' or spec == 'pop' or spec == 'action' or spec == 'mix' or spec == 'onsale' or spec == 'search' or spec == 'selection1' or spec == 'selection2' %}
  20.         <a href="{{ path('prod_list_cat_spec', {'cat_id': cat.id, 'cat_intname': cat.intname, 'spec': spec}) ~ search }}" class="leftcatmenuli">{{ cat.name |raw }} ({{ cat.prods }})</a>
  21.         {% else %}
  22.         <a href="{{ path('prod_list_cat', {'cat_id': cat.id, 'cat_intname': cat.intname}) ~ search }}" class="leftcatmenuli">{{ cat.name |raw }}</a>
  23.         {% endif %}
  24.         {% if menu[cat.id]|length %}
  25.         <ul class="jsddm jsddm-speccatmenu">
  26.             {% for subcat in menu[cat.id] %}
  27.             {% if subcat.prods or spec == 'default' or spec == '' %}
  28.             <li class="{% if menu[subcat.id]|length %}haschildren{% endif %}{% if subcat.id == cat_id or subcat.id == parent_id %} hover{% endif %}{% if subcat.newlabel %} newcat{% endif %}">
  29.                 {% if menu[subcat.id]|length %}
  30.                 <div class="sc4">
  31.                     <ul>
  32.                         {% set p = 0 %}
  33.                         {% for subsubcat in menu[subcat.id] %}
  34.                         {% if subsubcat.prods or spec == 'default' or spec == '' %}
  35.                         <li class="sc2{% if subsubcat.newlabel %} newsubcat{% endif %}" {% if p % 3==0 %} style="clear: both;" {% endif %}{% set p=p + 1 %}>
  36.                             {% if spec == 'default' or spec == '' %}
  37.                             <div class="pa w100">
  38.                                 <div class="pa sc4border"></div>
  39.                             </div>
  40.                             {% endif %}
  41.                             {% if spec == 'new' or spec == 'pop' or spec == 'action' or spec == 'mix' or spec == 'onsale' or spec == 'search' or spec == 'selection1' or spec == 'selection2' %}
  42.                             <a href="{{ path('prod_list_cat_spec', {'cat_id': subsubcat.id, 'cat_intname': subsubcat.intname, 'spec': spec}) ~ search }}" class="{% if subsubcat.id == cat_id or subsubcat.id == parent_id %}sub-active {% endif %}leftcatmenuli">
  43.                                 {% if subsubcat.newlabel %}
  44.                                 <div class="pa cat-newlabel"><img src="{{ asset('new.png', 'img') }}" alt=""></div>
  45.                                 {% endif %}
  46.                                 {{ subsubcat.name | raw }} ({{ subsubcat.prods }})
  47.                             </a>
  48.                             {% else %}
  49.                             <a href="{{ path('prod_list_cat', {'cat_id': subsubcat.id, 'cat_intname': subsubcat.intname}) ~ search }}" class="{% if subsubcat.id == cat_id or subsubcat.id == parent_id %}sub-active {% endif %}leftcatmenuli">
  50.                                 {% if subsubcat.newlabel %}
  51.                                 <div class="pa cat-newlabel"><img src="{{ asset('new.png', 'img') }}" alt=""></div>
  52.                                 {% endif %}
  53.                                 {{ subsubcat.name | raw }}
  54.                             </a>
  55.                             {# {% if catpages[subcat.id] is defined %}
  56.                             {% for catpage in catpages[subcat.id] %}
  57.                             <a href="{{ path('prod_list_cat', {'cat_id': subsubcat.id, 'cat_intname': subsubcat.intname}) ~ search }}" class="{% if subsubcat.id == cat_id or subsubcat.id == parent_id %}sub-active {% endif %}leftcatmenuli">
  58.                                 -- {{ catpage.name | raw }}
  59.                             </a>
  60.                             {% endfor %}
  61.                             {% endif %} #}
  62.                             {% endif %}
  63.                         </li>
  64.                         {% endif %}
  65.                         {% endfor %}
  66.                         <li class="noback" style="clear: both;"></li>
  67.                     </ul>
  68.                 </div>
  69.                 {% endif %}
  70.                 {% if spec == 'new' or spec == 'pop' or spec == 'action' or spec == 'mix' or spec == 'onsale' or spec == 'search' or spec == 'selection1' or spec == 'selection2' %}
  71.                 <a href="{{ path('prod_list_cat_spec', {'cat_id': subcat.id, 'cat_intname': subcat.intname, 'spec': spec}) ~ search }}" class="leftcatmenuli{% if subcat.id == cat_id or subcat.id == parent_id %} active{% endif %}">
  72.                     {{ subcat.name | raw }} ({{ subcat.prods }})
  73.                     {% if subcat.newlabel %}
  74.                     <div class="pa cat-newlabel"><img src="{{ asset('new.png', 'img') }}" alt=""></div>
  75.                     {% endif %}
  76.                 </a>
  77.                 {% else %}
  78.                 <a href="{{ path('prod_list_cat', {'cat_id': subcat.id, 'cat_intname': subcat.intname}) ~ search }}" class="leftcatmenuli{% if subcat.id == cat_id or subcat.id == parent_id %} active{% endif %}">
  79.                     {{ subcat.name | raw }}
  80.                     {% if subcat.newlabel %}
  81.                     <div class="pa cat-newlabel"><img src="{{ asset('new.png', 'img') }}" alt=""></div>
  82.                     {% endif %}
  83.                 </a>
  84.                 {% endif %}
  85.             </li>
  86.             {% endif %}
  87.             {% endfor %}
  88.         </ul>
  89.         {% endif %}
  90.     </li>
  91.     {% endif %}
  92.     {% endfor %}
  93. </ul>
  94. <style>
  95. </style>
  96. {#
  97. <script>
  98.     console.log('###');
  99.     
  100.     document.addEventListener('DOMContentLoaded', function () {
  101.         if (document.body.clientWidth >= 975) {
  102.             var timeout = 500;
  103.             var closetimer = 0;
  104.             var ddmenuitem = 0;
  105.             function jsddm_canceltimer2() {
  106.                 if (closetimer) {
  107.                     window.clearTimeout(closetimer);
  108.                     closetimer = null;
  109.                 }
  110.             }
  111.             function jsddm_close2() {
  112.                 if (ddmenuitem) ddmenuitem.style.display = 'none';
  113.             }
  114.             function jsddm_timer2() {
  115.                 closetimer = window.setTimeout(jsddm_close2, timeout);
  116.             }
  117.             function jsddm_open2() {
  118.                 jsddm_canceltimer2();
  119.                 jsddm_close2();
  120.                 ddmenuitem = this.querySelector('ul').style.display = 'block';
  121.             }
  122.             const menuItems = document.querySelectorAll('.jsddm-speccatmenu > li');
  123.             menuItems.forEach(item => {
  124.                 item.addEventListener('mouseover', jsddm_open2);
  125.                 item.addEventListener('mouseout', jsddm_timer2);
  126.             });
  127.         } else {
  128.         }
  129.     });
  130. </script>#}