Jump to content

Code to show Product Totals in Navigation.


Guest

Recommended Posts

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 by cbunting
Link to comment
Share on other sites

  • 4 months later...

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?

:rolly:

Link to comment
Share on other sites

  • 3 weeks later...
  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...