zipp06 Posted March 30, 2009 Share Posted March 30, 2009 Sadly, I can't get an answer from the developer's own forum. I just wanted to see if someone can help me figure this out. I am putting a small business directory on my website. The problem is, the category count won't work. I need it to show how many listings are in each category. This is critical since I will have dozens of categories and hundreds of sub-categories. A visitor needs to know at a glance if there are any businesses listed in a particular category. There is a file in the program where I believe the problem lies. I guess this function actually worked in an older version, but now it doesn't. There is some code that is commented out, but even if I un-comment it, it still only shows (0) for each category. I will post up the code if someone wants to take a stab at it. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/151741-idevspot-bizdirectory-225-help-with-category-count/ Share on other sites More sharing options...
zipp06 Posted March 30, 2009 Author Share Posted March 30, 2009 Here's the code in (what I think) is the culprit file. Anyone?? :'( <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="tdclass1"><span class="textclass1"><b> <?php category_header($_GET[category],home,browse,category, $rowxxx[MR]); ?> </b></span></td> </tr> </table> <img src="images/transparent.gif" width="10" height="10" /> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <?php //----------------------------------------------------------------------------------------- $SQLcaT = "SELECT * from CATEGORIES WHERE CATEGORY = '$_GET[category]' ORDER BY TITLE ASC"; $resultcaT = @mysql_query( $SQLcaT ); $maxcolumns = "3"; $nRecordCounter = 0; while( $rowcaT = @mysql_fetch_array( $resultcaT ) ) { if($nRecordCounter % $maxcolumns == 0) echo "<tr>"; //------------------------------------------------- ?> <td class="padder5" width="33%" valign="top"><span class="link1"><a href="<?PHP mr("dirbrowse", "$rowcaT[iD]", "$rowxxx[MR]", "?page=browse&category="); ?>"> <b> </b></a></span> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <?PHP IF ($rowcaT[CATICON] != $nil) { ?> <a href="<?PHP mr("dirbrowse", "$rowcaT[iD]", "$rowxxx[MR]", "?page=browse&category="); ?>"><img src="category_icons/<?PHP echo $rowcaT[CATICON]; ?>" border="0"></a><img src="images/transparent.gif" width="10" height="10" /> <?PHP } ?> </td> <td width="100%"><span class="link1"><a href="<?PHP mr("dirbrowse", "$rowcaT[iD]", "$rowxxx[MR]", "?page=browse&category="); ?>"><b> <?php echo $rowcaT[TITLE]; ?> </b> </a></span> <?PHP //---------------------------------------------------------------------- if ($rowxxx[COUNT_LISTINGS] == $nil || $rowxxx[COUNT_LISTINGS] == Yes) { // $sql_count = "SELECT count(*) FROM LISTINGS WHERE STATUS = 'Active' and CATEGORY = '$rowcaT[iD]'"; // $res_count = @mysql_query($sql_count); // $row_count = @mysql_fetch_row($res_count); // if ($row_count[0] != $nil) echo "<span class=itty_link>($row_count[0])</span>"; } //--------------------------------------------------------------------------- ?> <br> <?PHP //---------------------------------------------------------------------------------------- if ($rowxxx[sLIMIT] == $NIL) $rowxxx[sLIMIT] = 10; $SQLcaTsub = "SELECT * from CATEGORIES WHERE CATEGORY = '$rowcaT[iD]' ORDER BY TITLE ASC LIMIT $rowxxx[sLIMIT]"; $resultcaTsub = @mysql_query( $SQLcaTsub ); $i = 0; while( $rowcaTsub = @mysql_fetch_array( $resultcaTsub ) ) { $i = $i + 1; //--------------------------------------------------------- ?> <span class="subcat_link"><a href="<?PHP mr("dirbrowse", "$rowcaTsub[iD]", "$rowxxx[MR]", "?page=browse&category="); ?>"> <?php echo $rowcaTsub[TITLE]; ?> </a></span><?php if ($i == $rowxxx[sLIMIT]) echo "..."; else echo ", "; ?> <?PHP } ?> </td> </tr> </table> </td> <?PHP $nRecordCounter++; if($nRecordCounter % $maxcolumns == 0) echo "</tr>"; ?> <?PHP } ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/151741-idevspot-bizdirectory-225-help-with-category-count/#findComment-797073 Share on other sites More sharing options...
nacar Posted July 23, 2009 Share Posted July 23, 2009 Hi, Zipp06.. I have resolved this problem, resolve is below... Open bit_centerbar.php Find This Code : <?php echo $rowcaTsub[TITLE]; ?> Replace With This : <?php echo $rowcaTsub[TITLE].' ('.$row_subcount[0].')'; ?> Dont forget backup your original bit_centerbar.php file. Best Regards Nejdet ACAR Quote Link to comment https://forums.phpfreaks.com/topic/151741-idevspot-bizdirectory-225-help-with-category-count/#findComment-881355 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.