Support Forums


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

Notices

Reply
 
LinkBack Thread Tools Display Modes
Old 09-07-2008, 02:41 PM   #1
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 4
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,020
Rep Power: 116
Eric Barnes is a jewel in the rough
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
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 09-07-2008, 02:51 PM   #3
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 4
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
Senior Member
 
michael's Avatar
 
Join Date: Jan 2007
Posts: 365
Rep Power: 19
michael is a jewel in the rough
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.3 Developer - 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: 4
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
Coder
 
Join Date: Mar 2006
Posts: 4,442
Rep Power: 108
Lhotch is just really niceLhotch is just really nice
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.
http://www.68classifieds.com/forums/image.php?type=sigpic&userid=10&dateline=124541599  1
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
Coder
 
Join Date: Mar 2006
Posts: 4,442
Rep Power: 108
Lhotch is just really niceLhotch is just really nice
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.
http://www.68classifieds.com/forums/image.php?type=sigpic&userid=10&dateline=124541599  1
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
Senior Member
 
michael's Avatar
 
Join Date: Jan 2007
Posts: 365
Rep Power: 19
michael is a jewel in the rough
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.3 Developer - 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

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
How to show listings in sub-categories? ksuralta v4 Questions & Support 19 03-12-2009 02:22 AM
Hide Address and Phone Number in Listings goin4savvy v4 Questions & Support 2 06-18-2008 05:10 PM
Not all listings show when I "search listings" gabs v3.1 Questions & Support 6 12-29-2006 11:34 AM
Showing the number of ads in subcategories on main page pat01 v3.1 Modules & Modifications 6 07-19-2006 04:24 PM
Show Top Listings On Home Page zman78 HTML, CSS, and Design Help 3 04-21-2006 04:32 AM


All times are GMT -4. The time now is 04:50 PM.


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