Support Forums

Old 03-04-2009, 06:45 PM   #1
Member
 
Join Date: Jan 2009
Posts: 42
Rep Power: 2
sunshinemike is on a distinguished road
Default Dont show categories with no listings?

Is there any way I can prevent categories/sub-categories from being shown if there is no listing in them?

I have a site where there are 1200 categories but I only have listings in about 300 of them. It looks really bad to see so many categories with (0) after the title!

Thanks

Mike
__________________
V4.1.2 Developer

Beer.....so much more than a breakfast drink!
sunshinemike is offline   Reply With Quote
Old 03-05-2009, 06:19 AM   #2
Moderator
 
 
Join Date: Mar 2008
Posts: 769
Rep Power: 21
seymourjames has a spectacular aura about
Default

First of all why not turn the (0) off so it does not show. Then in showlistings when someone clicks through and the category is empty show the message - Do you want to be the first to place your advert here or show them a set of horzontal random listings or present them another search. Like here

Search Results

It is the same principle to adapt showlistings for empty searches and empty categories. It is also SEO smart to avoid duplicate content on different URLs.

Secondly but I would not bother, you may be able to test if the category is empty and if it is then don't show it. Use debug to find the variable (if it is available to the browse and home pages for example) and test within this part of code before echoing.

{section name=tr loop=$data step=$cols}
<tr>
{section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+$cols}
<td>
{if $data[td]<>""}
<img src="{$data[td].image}" alt="{$data[td].name}" /> {$data[td].start_link|replace:'>':" title=\"`$data[td].name`\" rel='nofollow'>"}<strong>{$data[td].name}</strong></a>
{if $data[td].total <> ''}
({$data[td].total})
{/if}
{/if}
 
</td>
{/section}
</tr>
{/section}
__________________
TemplateCodes.com
seymourjames is offline   Reply With Quote
Old 03-05-2009, 09:18 AM   #3
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,750
Rep Power: 110
Eric Barnes is a jewel in the rough
Default

Maybe something like {if $data[td].total > 0} //show the category {/if}
__________________
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 03-05-2009, 01:22 PM   #4
Member
 
Bronxgodzilla's Avatar
 
Join Date: Jun 2008
Posts: 63
Rep Power: 5
Bronxgodzilla is on a distinguished road
Default

David I think your code is SEO brilliant and is a model to put an <IF> statement to anything -- and Eric, your simplicity is mystically eloquent. Uhhhh, any of you boys care to share *where* your code goes, for us newbies?

Thanks really,
Barry
__________________
Using Version 4.0.9 Developer Edition & loving it
Bronxgodzilla is offline   Reply With Quote
Old 03-05-2009, 01:38 PM   #5
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,750
Rep Power: 110
Eric Barnes is a jewel in the rough
Default

Sorry for not including that. Try this. Open home.tpl and you should see something like this:
Code:
{if $data[td]<>""}
Replace it with:
Code:
{if $data[td]<>"" && $data[td].total > 0}
__________________
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
How to show listings in sub-categories? ksuralta v4 Questions & Support 19 03-12-2009 02:22 AM
How to show list of categories safatweb v4 Modules / Modifications 9 10-31-2008 12:53 PM
Show Listings help dollpage v4 Questions & Support 3 10-09-2008 09:09 PM
Show 2nd level categories on homepage? Success v4 Questions & Support 8 06-11-2008 09:16 PM
Extra Fileds dont show up MADKing v3.1 Questions & Support 10 08-12-2007 03:57 PM


All times are GMT -4. The time now is 01:13 AM.


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