Распределение брендов по группам по алфавиту

Нужно поменять шаблон вывода всех брендов в настройках плагина на такой:

<style>
  .l-brands .brand {
    display: inline-block;
    margin: 0 20px 10px 0;
    vertical-align: middle;
  }
  .l-brands .brand a { font-size: 150%}
  .l-brands .brand img { max-width: 120px}
</style>  

{$_letters = []}
{foreach $brands as $b_id => $b}
  {$_c = mb_strtoupper(mb_substr($b.name, 0, 1))}
  {if is_numeric($_c)}
      {$_c = '0-9'}
  {/if}
  {$_letters[$_c][$b_id] = $b}
{/foreach}

{$_ = ksort($_letters)}

{foreach $_letters as $_l => $_l_brands}
  <h3>{$_l}</h3>

  <div class="l-brands">
    {foreach $_l_brands as $b}
    <div class="brand">
      <a href="{$b.url}" title="{$b.name|escape}">{if $b.image}<img src="{$wa_url}wa-data/public/shop/brands/{$b.id}/{$b.id}{$b.image}">{else}{$b.name}{/if}</a>
    </div>
    {/foreach}
  </div>  
{/foreach}
Posted: October 3, 2016
Was this article helpful? Yes No

0 comments

    Add comment

    To add a comment please sign up or login