Support Forums


Go Back   68 Classifieds Forums > Help & Support > Modules / Plugins / Modifications

Notices

 
LinkBack Thread Tools Display Modes
Old 08-23-2008, 03:55 PM   #1
Member
 
Join Date: Jul 2008
Posts: 77
Rep Power: 6
centinel3 is on a distinguished road
Default category total on left menu

I have read a ton of threads on how to display the total number of listings beside the category on a left menu bar and can't make any of the methods work. I have a left side menu with parent categories. All I would like to do is have the running total of each category next to the name.

I came close to having this, though the numbers were on the top left of each text line and got a few errors to boot.

Is there an easy way to get this to show?

Chris
centinel3 is offline   Reply With Quote
Old 08-26-2008, 08:33 AM   #2
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,191
Rep Power: 120
Eric Barnes is a jewel in the rough
Default

Hi,

You should be able to use this:
Code:
{categories_parent}
<ul>
{foreach from=$pcat item=entry}
<li>{$entry.link}</li>
{/foreach}
</ul>
Please note that this will only pull the parent categories.
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 08-26-2008, 08:47 AM   #3
Member
 
Join Date: Jul 2008
Posts: 77
Rep Power: 6
centinel3 is on a distinguished road
Default nothing happened

I put in your code and nothing happened. No totals anywhere. When you said that only the parent categories would show totals, if there were a couple of subs in on parent category, then that parent category would show (0)? Is there a way to show totals of the parent and any and all subs?

Here is the code that I have in the layout.tpl file thus far. I tried the code you suggested and then replaced the original back again when it didn't work.

<div id="sidebar"> <h1>{$smarty.const.LANG_TPL_NAVIGATION}</h1>
<ul class="sidemenu">
{categories_parent}
{foreach from=$pcat item=entry}
<li>{$entry.link}</li>
{/foreach}
</ul>
</div>
centinel3 is offline   Reply With Quote
Old 08-26-2008, 08:57 AM   #4
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,191
Rep Power: 120
Eric Barnes is a jewel in the rough
Default

Replace the file includes/classes/smarty/plugins/function.categories_parent.php with the code below:
PHP Code:
<?php
/**
* @copyright 68 Classifieds
*
* @author $Author: suzkaw $
* @version $Revision: 400 $
* @package Smarty
* @subpackage plugins
*
* @Updated: $Date: 2008-08-22 15:16:17 -0400 (Fri, 22 Aug 2008) $
*/

/**
 * This function is useful for using your parent categories in the navigation
 * 
 * To Call this function in your template you would use: 
 * <code>{categories_parent}
 * {foreach from=$pcat item=entry}
 * <ul>
 * <li>{$entry.link} {$entry.total}</li>
 * </ul>
 * {/foreach}</code>
 * 
 */

/**
 * Include categories class
 */
require_once(FILESYSTEM_PATH .'includes/classes/kernel/Categories.php');

function 
smarty_function_categories_parent($params, &$smarty)
{
    global 
$db$class_tpl$arr_childs;
        
        
$Categories = new Categories;
        
$sSQL "SELECT id,name,cLink,slug FROM ".PREFIX."categories WHERE parent_id = 0 AND display<>'N' ORDER BY cORDER DESC, name ASC";
        
$result=$db->query($sSQL);
        
$i=0;
        while(
$rs=$result->fetch())
        {
            if(
$arow['cLink']<>"")
            {
                
$rs['link']='<a href="'.$rs['cLink'].'">'.$rs['name'].'</a>';
            }
            else
            {
                
$rs['link']='<a href="category.php?cat='.$rs['slug'].'">'.$rs['name'].'</a>';
            }
            
$arr_childs = array($rs['id']);
            
$Categories->get_ids($arr_childs);
            
$rs['total']=$Categories->get_count($arr_childs);
            
$cat[]=$rs;
        }
    
$class_tpl->assign('pcat'$cat);
}
?>
Then in your template file add:
Code:
{categories_parent}
<ul>
{foreach from=$pcat item=entry}
<li>{$entry.link} {$entry.total}</li>
{/foreach}
</ul>
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 08-26-2008, 09:09 AM   #5
Member
 
Join Date: Jul 2008
Posts: 77
Rep Power: 6
centinel3 is on a distinguished road
Default almost there

I got the numbers though it looks a bit off. Plus, the numbers aren't accurate. Any suggestions?

You can see what I'm looking at here:
http://www.closeoutfloorsamples.com/?template=TEST

chris
centinel3 is offline   Reply With Quote
Old 08-26-2008, 09:15 AM   #6
Coder
 
Join Date: Mar 2006
Posts: 4,631
Rep Power: 112
Lhotch is a glorious beacon of lightLhotch is a glorious beacon of lightLhotch is a glorious beacon of light
Default

Quote:
Originally Posted by centinel3 View Post
I got the numbers though it looks a bit off. Plus, the numbers aren't accurate. Any suggestions?

You can see what I'm looking at here:
http://www.closeoutfloorsamples.com/?template=TEST

chris
I dont have any suggestions but I just want to make you aware that doing category counts uses a lot of resources and can take a lot of time when a site starts to get busy. This can add a much dreaded delay on page loads and cause the user experience to rapidly deteriorate.

With that in mind, all of your time and energy invested now may be wasted when your site gets busy and you want to disable the counting. Category counts used to be in the template by default but too many people complained it slowed down their sites too much.
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 08-26-2008, 10:01 AM   #7
Member
 
Join Date: Jul 2008
Posts: 77
Rep Power: 6
centinel3 is on a distinguished road
Default thank you

Isn't that the case. You have something and people complain, then you take it away and they continue to complain about the lack of the product that they didn't like to begin with. It makes sense and I really hope to have this site buzzing with all kinds of ads. With this info, I'm going to let this one go. No numbers is fine, though I think for now I'm going to leave the totals on the subs. Thanks again for your help. Talk with you later.
Chris
centinel3 is offline   Reply With Quote
Old 08-26-2008, 10:26 AM   #8
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,191
Rep Power: 120
Eric Barnes is a jewel in the rough
Default

Quote:
Originally Posted by centinel3 View Post
Isn't that the case. You have something and people complain, then you take it away and they continue to complain about the lack of the product that they didn't like to begin with. It makes sense and I really hope to have this site buzzing with all kinds of ads. With this info, I'm going to let this one go. No numbers is fine, though I think for now I'm going to leave the totals on the subs. Thanks again for your help. Talk with you later.
Chris
Ha Ha that is so true. What is really frustrating is removing something because it caused an issue then totally forgeting about it and adding it back in later only to repeat the process.
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display all ads and their category hel68c Modules / Plugins / Modifications 5 08-21-2008 04:36 PM
Disable category listing total LittleRascal v3.1 Questions & Support 4 08-01-2008 02:45 PM
How to display category total listings? dankellaway v3.1 Questions & Support 2 03-13-2007 01:25 PM
EhopRealty.com DVM Site Critiques 10 02-12-2007 12:49 PM
Category Menus versatility v3.1 Questions & Support 5 08-08-2006 12:17 PM


All times are GMT -4. The time now is 07:49 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0