W
W
webhero2021-03-30 05:14:51
Smarty
webhero, 2021-03-30 05:14:51

How to make a condition on a menu item in Smarty?

There was an interest, how can I make a different layout for different menu items in the Webasyst LOOP (Shop-Script) Hovering
over one menu item - one layout of the drop-down menu
Hovering over another menu item - another layout of the drop-down menu, etc.

>currentUrl(true) == ' site.dv/services '} - it works, but only understandable on this page
How do I replace this condition by menu item
AND is it even POSSIBLE?

Code below

{$items = $wa->menu->get(1)}
              {foreach $items as $item}  
              <li class="level_1__item level_2__small">
                <a class="level_1__link " href="{$item.url}">{$item.name}
                  <i class="level_1__trigger megamenu_trigger" data-submenu="menu_1524227640085"></i>
                </a>
              {if !empty($item.childs)}
              <ul class="level_2" id="menu_1524227640085">
              {foreach $item.childs as $child} 
                <li>
                  <div>
                    <ul class="level_3">
                      <li class="level_3__item ">
                        <a class="level_3__link" href="{$child.url}">{$child.name}</a>
                      </li>
                    </ul>
                  </div>	
                </li>
              {/foreach}
              </ul>
              {/if}
              </li>
              
              {if $wa->currentUrl(true) == 'http://site.dv/services/'}
              <li class="level_1__item level_2__links">
                <a class="level_1__link " href="{$item.url}">{$item.name}
                  <i class="level_1__trigger megamenu_trigger" data-submenu="menu_1525679653045"></i>
                </a>
                {if !empty($item.childs)}
                <ul class="level_2" id="menu_1525679653045">
                  {foreach $item.childs as $child} 
                  <li class="container">
                    <div class="megamenu_col__item align_center">
                      <a href="{$child.url}"><img src="//cdn.shopify.com/s/files/1/0068/9753/3028/files/coca-cola_t-shirt_3_255x180_crop_center.jpg?v=1544026139" alt="Color">
                        <h4>{$child.name}</h4>
                      </a>
                    </div>
                    </li>	
                    {/foreach}
                  </ul>
                {/if}	
                </li>	
              {/if}								
              {/foreach}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Belov, 2021-07-27
@Roosso

I'm not entirely sure of the accuracy of the answer, I haven't touched SS for a long time
{if $item.url == "services"}{/if}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question