Support Forums

How to show the number of listings in subcategories?

This is a discussion on How to show the number of listings in subcategories? within the Modules / Plugins / Modifications forums, part of the Developer Forums category; Does anyone know? or has anyone done this? is it possible? #1. How to show the number of listings in ...


Go Back   68 Classifieds Forums > Developer Forums > Modules / Plugins / Modifications

Reply
 
Thread Tools Display Modes
Old 09-07-2008, 02:41 PM   #1
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 9
AHTOXA is on a distinguished road
Question How to show the number of listings in subcategories?

Does anyone know? or has anyone done this? is it possible?

#1. How to show the number of listings in subcategories?
#2. How to make subcategories be displayed 1 per line, not all in 1 line?

Like so:

Autos (15)
-> Honda (5)
-> Nissan (5)
-> Toyota (5)


This is what I got so far

Autos (15)
Honda Nissan Toyota ...


Please help, thank you so much

Last edited by AHTOXA; 09-07-2008 at 02:54 PM.
AHTOXA is offline   Reply With Quote
Old 09-07-2008, 02:47 PM   #2
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,471
Rep Power: 131
Eric Barnes is just really nice Eric Barnes is just really nice
Default

#1 is not currently possible.
#2 is possible but would require the developer edition. You would need to alter the getSubCategoriesList in the Categories class.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 09-07-2008, 02:51 PM   #3
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 9
AHTOXA is on a distinguished road
Default

I do have the Developer v4, can you please be more specific on how and what to alter?

Thanks
AHTOXA is offline   Reply With Quote
Old 09-07-2008, 03:46 PM   #4
Just get on with it!
 
michael's Avatar
 
Join Date: Jan 2007
Location: Milton Keynes, England
Posts: 463
Rep Power: 29
michael is just really nice michael is just really nice
Default

For [2]:

Go to includes>classes>kernel>Categories.php and insert a <br /> where shown. I've also the increased limit to 99 to ensure all subcats are displayed.

--------------------------------------------------


function getSubCategoriesList($parent, $limit=99)
{
global $db;
$add_cats='';
$sSQL2 = "SELECT id,name,slug,image,cLink FROM ".PREFIX."categories WHERE parent_id = ".$parent." AND display<>'N' ORDER BY cORDER DESC, name ASC LIMIT ".$limit;
$result2=$db->query($sSQL2);
while($rs=$result2->fetch())
{
if($rs['cLink']<>"")
{
$add_cats.='<a href="'.$rs['cLink'].'">'.htmlspecialchars($rs['name']).'</a><br />';
}
else
{
$slug = ( empty($rs['slug']) ) ? $rs['id']: $rs['slug'];
$add_cats.='<a href="category.php?cat='.$slug.'">'.htmlspecialcha rs($rs['name']).'</a><br />';
}

}
if($add_cats=="")
{
$sub=htmlspecialchars($rs['description']);
}
else
{
$sub='<div class="small">'.$add_cats . LANG_DOT_DOT_DOT.'</div>';
}
return $sub;
}

--------------------------------------------------------
__________________
M Michael
V4.1.9 Developer - Modified 3 Column Default Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
michael is offline   Reply With Quote
Old 09-16-2008, 08:00 PM   #5
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 9
AHTOXA is on a distinguished road
Default

thanks Michael, it works perfect!

let me know if you hear someone was able to show number of listings for each subcategory
AHTOXA is offline   Reply With Quote
Old 09-16-2008, 08:05 PM   #6
curmudgeon
 
Join Date: Mar 2006
Posts: 5,274
Rep Power: 129
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Just and FYI, This used to be a standard feature a couple versions ago but doing all those worthless database queries really slows things down so most ended up disabling it.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 11-16-2008, 06:46 AM   #7
Junior Member
 
Join Date: Nov 2008
Posts: 2
Rep Power: 0
jonathan.melnick is on a distinguished road
Lightbulb Sounds easy

I'm new to 68Classifieds so you'll have to forgive me if there is a point I am missing out.

Sounds easy.

Add a "counter" field to the categories table, then use one of the two following options ; or better, mix both.

1. Modify all files that add/edit/delete/expire ad posts to update the corresponding "counter" field.
2. Add a cron job to update the "counters".

Finally, update the templates accordingly.

Thoughts anyone?
jonathan.melnick is offline   Reply With Quote
Old 11-16-2008, 10:28 AM   #8
curmudgeon
 
Join Date: Mar 2006
Posts: 5,274
Rep Power: 129
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Sure, that would work and technically speaking likely pretty easy to do however it would invloved modifying quite a few files so the question then becomes is it worth the time?

The next question is when an a new version of 68c comes out and one of your modded files changes you have to transfer over you shanges for the counter column, so does the extra work in managing this "feature" worth it? Not for me personally.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 11-16-2008, 03:28 PM   #9
Junior Member
 
Join Date: Nov 2008
Posts: 2
Rep Power: 0
jonathan.melnick is on a distinguished road
Default

Sure.

Nonetheless, you could stick only with the cron job and the "counter" field. When upgrading, you would only have to worry about the "counter" field (and not modified files). Of course, a custom module would be in charge of "filling in" the "counter" fields, so an upgrade would not require modifying any files (unless the upgrade requires all modules to change their behaviour, which would impact all modules and not only this one).

This solution was especially ment to address the "worthless database queries". I suppose caching those database queries would also leverage the impact of these "worthless queries".

Also, I would expect this feature to be part of the core. Each and every client for which I have had to implement classifieds has requested this feature. If they want it, anything is worth it. I really don't see myself telling them: "Well, it's possible, but it makes my job a lot harder, so if you don't mind, we'll skip that one, ok?"

Finally, can you think of any other simple solution ?

Just my two cents worth...
jonathan.melnick is offline   Reply With Quote
Old 06-01-2009, 07:02 AM   #10
Just get on with it!
 
michael's Avatar
 
Join Date: Jan 2007
Location: Milton Keynes, England
Posts: 463
Rep Power: 29
michael is just really nice michael is just really nice
Default

It's been a little while and I was wondering if anyone has successfully addressed the posters opening question; "How to show the number of listings in subcategories?"

I understand Larry's concerns over the "worthless database queries" but if you don't display categories on your home page then it's loading will not be delayed right? Once a user clicks 'Browse' to category.php I would just like them to avoid clicking on empty category links and be shown nothing for their effort.

This certainly isn't a high priority, just kinda hoping . . .
__________________
M Michael
V4.1.9 Developer - Modified 3 Column Default Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)

Last edited by michael; 06-01-2009 at 07:14 AM. Reason: clarification
michael is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show listings in sub-categories? ksuralta Technical Support 19 03-12-2009 02:22 AM
Hide Address and Phone Number in Listings goin4savvy Technical Support 2 06-18-2008 05:10 PM
Show Top Listings On Home Page zman78 Templates, HTML, CSS, and Design Help 3 04-21-2006 04:32 AM


All times are GMT -4. The time now is 12:48 AM.


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