![]() |
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 |
Re: Hiding subcategories when they don't have products
{foreach from=$subcategories item=subcategory}
{if $subcategory.product_count > 0} <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> {/if} {/foreach} |
Re: Hiding subcategories when they don't have products
Thanks Steve.
|
All times are GMT -8. The time now is 05:11 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.