View Single Post
  #1  
Old 03-14-2010, 07:00 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Hiding subcategories when they don't have products

I have a number of subcategories that don't have products in them at the moment. On the subcategories page, I would like to be able to hide these subcategories.

When they do have products in them, they should be displayed on the page again.

Here is the subcategories.tpl code:

{*
$Id: subcategories_t.tpl,v 1.6 2008/11/25 15:57:54 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{foreach from=$subcategories item=subcategory}

<div class="subcategories" style="min-width: {$subcat_div_width}px; width: {$subcat_div_width}px; height: {$subcat_div_height}px; min-height: {$subcat_div_height}px;">
{if $subcategory.is_icon}
<a href="home.php?cat={$subcategory.categoryid}"><img src="{$subcategory.icon_url|amp}" alt="{$subcategory.category|escape}" width="{$subcategory.image_x}" height="{$subcategory.image_y}" /></a>
{else}
<img src="{$ImagesDir}/spacer.gif" alt="" width="1" height="{$subcat_img_height}" />
{/if}
<br />
<a href="home.php?cat={$subcategory.categoryid}">{$su bcategory.category|escape}</a><br />
{if $config.Appearance.count_products eq "Y"}
{if $subcategory.product_count}
{$subcategory.product_count} {$lng.lbl_products|lower}
{elseif $subcategory.subcategory_count}
{$subcategory.subcategory_count } {$lng.lbl_categories|lower}
{/if}
{/if}
</div>

{/foreach}
<div class="clearing"></div>

--

Ca anyone please help?

Thanks
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote