One small bug .... lets say you have one product and 5 subcategories, it will not show the subcategories because it automatically jumps to the one product. To fix it :
Code:
{if $products|@count eq 1}
{if $subcategories}{else}
{assign var="prodURL" value="product.php?productid=`$products.0.productid`&cat=$cat&page=1"}
{php}
header( "Location: " . $GLOBALS[smarty]->_tpl_vars[prodURL] );
{/php}
{/if}
{/if}