Guest Posted July 31, 2004 Share Posted July 31, 2004 (edited) I've been asked a couple of time about how I show the amount of products per category in my cat_navi.php. Here are my modifications.. Here are my changes.. <?php /*************************************************************************** * File Info: cat_navi.php * Purpose: Â Displays The Category Links Navigation * Updated: Â 31/07/2003 **************************************************************************** Â * Developer: Alistar Brookbanks (Brooky.com) * Copyright: (C)2003 http://www.brooky.com * Copyright: (C)2003 http://www.cubecart.com * This program is not "free" software and restrictions apply! * Further Info: http://www.cubecart.com/license.php * Contact [email protected] if any conditions are not clear. * * Licensees holding valid "CubeCart Licence Number" may edit * the (powered by CubeCart) from browser title and "Powered by CubeCart" * and "(c) Brooky.com" from the web page footer. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. This and all others in the download package can only be * redistributed with written permission from Alistair Brookbanks! * * The "CubeCart License" is available to purchase at * https://secure.cubecart.com/ * For pricing please contact us via e-mail at [email protected] ***************************************************************************/ $query = "SELECT * FROM ".$prefix."store_category where cat_father_id = 0 order by $cat_order"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); // start border sb("140","$la_cat_navi_category",$colour_1,$bg_colour); // list Top-Level navigation echo "<table border=\"0\" cellspacing=\"0\" width=\"100%\" cellpadding=\"2\" align=\"left\" bgcolor=\"#FFFFFF\"> <tr> <td><img src='images/bullet.gif' border='0'> </td> <td align=\"left\"><a href='index.php'>$la_search_home</a></td> </tr>"; while ($row = mysql_fetch_array($result)) { $cat_id_list = $row["cat_id"]; $category = $row["category"]; $get_num_rows = "SELECT COUNT(cat_id) FROM ".$prefix."store_inventory WHERE cat_id = '$cat_id_list'"; $get_num_rows_rs = mysql_query($get_num_rows); $numc_rows = mysql_result($get_num_rows_rs,0, 'count(cat_id)'); echo"<tr> <td><img src='images/bullet.gif' border='0'></td><td align=\"left\"><a href='index.php?cat_id=$cat_id_list'>$category</a> <span class=\"num_rows\">($numc_rows)</span></td> </tr>"; } if($sale=="Y") { echo"<tr><td width='6'><img src='images/bullet.gif' border='0'></td><td align=\"left\"><a href='sale_cat.php'>$la_sale_items</a><td></tr>"; } echo"</table>"; // end border eb($bg_colour,$colour_1); ?> <?php mysql_free_result($result); ?> The code for style.css .num_rows {font-size: 8px; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; } This had a small bug but I think I have fixed it.. Chris Edited July 31, 2004 by cbunting Quote Link to comment Share on other sites More sharing options...
Guest Posted July 31, 2004 Share Posted July 31, 2004 As far as I can see, the bug in the above code has been fixed.. Let me know if you have a problem. Chris Quote Link to comment Share on other sites More sharing options...
Guest Posted December 13, 2004 Share Posted December 13, 2004 HI, THIS MOD LOOKED PRETTY GOOD TO ME, SO I TRIED IT, AND IT'S GREAT, BUT........WHY DOESN'T IT REGISTER WHAT IS IN THE SUBCATAGORIES? NOT MUCH GOOD IF IT SAYS THERE NOTHING IN THAT CATAGORY WHEN REALLY THERE ARE SEVERAL SUBFOLDERS WITH 100 THINGS IN EACH. DON'T SUPPOSE YOU'VE HAD CHANCE TO UPDATE IT? Quote Link to comment Share on other sites More sharing options...
Guest [email protected] Posted December 13, 2004 Share Posted December 13, 2004 WOW! YOUR CAPS ARE GETTING BIGGER EVERY TIME. (super glue or coca cola spilled over your keyboard Joelene?) Quote Link to comment Share on other sites More sharing options...
Guest Posted December 29, 2004 Share Posted December 29, 2004 SORRY! There I turned them off. Still don't get this mod though Anyone else managed to get it to tally the sub categories yet? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2005 Share Posted July 28, 2005 yeah that'd be good if it could tally the sub cats. Then i'd be using it for sure :errm: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.