68 Classifieds 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 v4 Modules / Modifications forums, part of the Help & Support 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 > Help & Support > v4 Modules / Modifications

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-07-2008, 03:41 PM
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 1
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 03:54 PM.
Reply With Quote
  #2  
Old 09-07-2008, 03:47 PM
Eric Barnes's Avatar
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,130
Rep Power: 94
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 | Submit a Ticket | Twitter
Reply With Quote
  #3  
Old 09-07-2008, 03:51 PM
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 1
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
Reply With Quote
  #4  
Old 09-07-2008, 04:46 PM
michael's Avatar
Senior Member
 
Join Date: Jan 2007
Posts: 258
Rep Power: 13
michael is on a distinguished road
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;
}

--------------------------------------------------------
__________________
v4.09 Developer
MKClassifieds


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
Reply With Quote
  #5  
Old 09-16-2008, 09:00 PM
Junior Member
 
Join Date: Sep 2008
Posts: 10
Rep Power: 1
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
Reply With Quote
  #6  
Old 09-16-2008, 09:05 PM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,387
Rep Power: 83
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #7  
Old 11-16-2008, 07:46 AM
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?
Reply With Quote
  #8  
Old 11-16-2008, 11:28 AM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,387
Rep Power: 83
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #9  
Old 11-16-2008, 04:28 PM
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...
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
Hide Address and Phone Number in Listings goin4savvy v4 Questions & Support 2 06-18-2008 06:10 PM
How to show listings in sub-categories? ksuralta v4 Questions & Support 16 04-28-2008 02:08 PM
Not all listings show when I "search listings" gabs v3.1 Questions & Support 6 12-29-2006 12:34 PM
Showing the number of ads in subcategories on main page pat01 v3.1 Modules & Modifications 6 07-19-2006 05:24 PM
Show Top Listings On Home Page zman78 HTML, CSS, and Design Help 3 04-21-2006 05:32 AM


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


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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22