| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Hiding subcategories when they don't have products | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() {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}
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() Thanks Steve.
|
|||||||
|
|||
X-Cart forums © 2001-2020
|