Jump to content

Better list (alphabetical group) for manufacturers


Recommended Posts

  • 2 years later...
  • 1 year later...

Hello @NemoPS there should be an small mistake into your brand list code of your tutorial.

It must be a tiny mistake with because the first div of numeral characters doesn't render properly.

Are you aware of this? Could you take a look at that?

Thanks

brands-nemops.jpg

Link to comment
Share on other sites

SOLVED.

This code is what worked for me thanks to @diphone based on @NemoPS code

   

	<div class="all-brands">
     <div class="row"> 
     <ul class="letter-select clearifx">
       <li><a href="#letter_0">#</a></li>
       <li><a href="#letter_A">A</a></li>
       <li><a href="#letter_B">B</a></li>
       <li><a href="#letter_C">C</a></li>
       <li><a href="#letter_D">D</a></li>
       <li><a href="#letter_E">E</a></li>
       <li><a href="#letter_F">F</a></li>
       <li><a href="#letter_G">G</a></li>
       <li><a href="#letter_H">H</a></li>
       <li><a href="#letter_I">I</a></li>
       <li><a href="#letter_J">J</a></li>
       <li><a href="#letter_K">K</a></li>
       <li><a href="#letter_L">L</a></li>
       <li><a href="#letter_M">M</a></li>
       <li><a href="#letter_N">N</a></li>
       <li><a href="#letter_O">O</a></li>
       <li><a href="#letter_P">P</a></li>
       <li><a href="#letter_Q">Q</a></li>
       <li><a href="#letter_R">R</a></li>
       <li><a href="#letter_S">S</a></li>
       <li><a href="#letter_T">T</a></li>
       <li><a href="#letter_U">U</a></li>
       <li><a href="#letter_V">V</a></li>
       <li><a href="#letter_W">W</a></li>
       <li><a href="#letter_X">X</a></li>
       <li><a href="#letter_Y">Y</a></li>
       <li><a href="#letter_Z">Z</a></li>        
     </ul>
    </div>

     <div class="brands-by-letter">
         {$current_letter = '#'}
         {$first_loop = true}
         {foreach from=$brands item=brand}
           {$first_letter = $brand.name|substr:0:1}
           {if $current_letter != $first_letter}
             {if !$first_letter|in_array:['0','1','2','3','4','5','6','7','8','9']}
               {$current_letter = $first_letter|upper}
               </div>
             </div>
             {/if}

             {if !$first_letter|in_array:['0','1','2','3','4','5','6','7','8','9'] || $first_loop}
             <div class="box-letter clearfix" id="letter_{if $current_letter == '#'}0{else}{$current_letter|upper}{/if}">
               <div class="box-title">{$current_letter|upper}</div>
               <div class="letter-content">
         {$first_loop = false}
              {/if}  
           {/if}
           <p>
             <a href="{$link->getManufacturerLink($brand.id_manufacturer)}">{$brand.name}</a>
           </p>


         {/foreach}
       </div>
       </div>

    </div>
   </div>

 

Link to comment
Share on other sites

  • 5 months later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...