Jump to content

Brand page: Show only brands with enabled products


Recommended Posts

Hello, I am stuck on the following problem. I have modified the themes\classic\templates\catalog\brands.tpl page to show all the brands we have in the webshop (thx Vekia + Nemo). Now I would like to modify it so it only shows brands which have a quantity of >0 products.

Any advice is kindly appreciated! Running PS 1.7.6

 

P.s. I don't want to disable the brands manually, the assortment varies too much and is too big of a task for the employees to manage this as well.

 

<div class="brands-by-letter">
	
         {$current_letter = '#'}
         {foreach from=$brands item=brand}
		 
  {* I guess here I should perform a check if $brands > (product.quantity 0).. but how? *}
  
           {$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']}
				{assign var=counterletters value=$counterletters+1}
               {$current_letter = $first_letter|upper}
               </div>
             </div>
             {/if}
             
			{if ($counterletters) is div by 3}
			  <div class="clearfix"></div>
			{/if} 
             <div class="box-letter col-md-4 col-xs-12" id="letter_{if $current_letter == '#'}0{else}{$current_letter|upper}{/if}">
               <div class="box-title"><h1>{$current_letter|upper}</h1></div>
               <div class="letter-content">
           {/if}
           <p>
             <a href="{$link->getManufacturerLink($brand.id_manufacturer)}">{$brand.name}</a>
           </p>
		   
         {/foreach}
       </div>
       </div>
	   <div class="clearfix"></div>
     </div>
 </div> 

 

Edited by GFX_dev
ps version... (see edit history)
Link to comment
Share on other sites

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...