PhotoPost Photo Gallery Sales PhotoPost Sales Toll Free Phone Number
Mon-Fri 9am-4pm EST
  PhotoPost Photo Sharing Photo Gallery    Visualize community tm
| | | | | | | | |

Go Back   PhotoPost Community > PhotoPost Support > PhotoPost Classifieds Support > Classifieds How do I...?

Classifieds How do I...? Wondering how to do something in Classifieds?

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old June 29th, 2006, 12:39 AM   #1 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Can Inc_Classifieds Only Show Categories with Ads?

I was curious if the inc_classifieds module is capable of only showing categories that have active/current ads, rather than showing all categories? The entire display is perfect, but I just want to limit the categories to those that have ads (and of course list the parents so there's a path to them).
GateKeeper is offline   Reply With Quote
Old June 29th, 2006, 09:08 AM   #2 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 71,940
Well you could try adding something like this in bold

Code:
Content visible to verified customers only.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 29th, 2006, 09:35 AM   #3 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Thanks for the tip

I tried that, but it appears that even if you can narrow the select statement (and I believe what you suggest works), the routine below it still does something with each category anyway and the whole thing gets confused and returns a bunch of blank rows, one for every category that doesn't have an ad. The blank rows down't have the category names either (implying they aren't in the results array), just the status "Never". I suspect it must have something to do with either the permissions array defined earlier in the routine or something, but it takes a lot longer to execute, too, when the query statement is written as such. I think it's close, but some other aspect of the routine is still evaluating all of the categories and printing them out, without their names.
I appreciate your effort and realize that this is probably bordering on a hack, but thought it might be simple enough that others might be keen on reading. If you have any other ideas, I'll be happy to test them out.
Thanks again,
-GateKeeper
GateKeeper is offline   Reply With Quote
Old June 29th, 2006, 09:40 AM   #4 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Here's a visual aid!

Here's a link to the results based on the modified query.
http://www.timesharegateway.com/foru...hp?page=promo1

Scroll towards the bottom.
GateKeeper is offline   Reply With Quote
Old June 29th, 2006, 09:59 AM   #5 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 71,940
Try also adding this in bold

Code:
Content visible to verified customers only.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 29th, 2006, 11:12 AM   #6 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Return "nothing"

That puts the whole thing out of commission.
http://www.timesharegateway.com/foru...hp?page=promo1

BTW:
Not sure if this was intended, but I noticed that the URL built to go to the categories in inc_classifieds uses showcat.php and not index.php. I would think that with the index.php being a cleaner solution for categories with no ads, that this might be a better choice. Then again, it might be developer's choice.
GateKeeper is offline   Reply With Quote
Old June 29th, 2006, 11:24 AM   #7 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Got it!

Same line of code, just further down in the script:

Quote:
// Which folder do we display
$boardfolder = "nonewposts.gif";
if ( $numnew > 0 || ($UserID == 0 && $showphotos > 0) ) {
$boardfolder = "newposts.gif";
}

if ( $numproducts == 0 ) continue;

$pp_cat_list .= <<<PPPRINT

<tr align="center">
<td class="alt2"><img src="images/statusicon/forum_old.gif" alt="" border="0" /></td>
<td class="alt1Active" align="left">
<div><a href="$class_path/index.php?cat=$CatID"><strong>$Title</strong></a></div>
<div class="smallfont">$Description</div>
</td>
GateKeeper is offline   Reply With Quote
Old June 29th, 2006, 11:27 AM   #8 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Where are my manners?

I forgot to say "thank you"!
Thank you! This is great for a site with a lot of categories, too. Maybe an option for a future version..."Show only categories with ads? Yes/No" in configuration section.
Much obliged.
-GateKeeper
GateKeeper is offline   Reply With Quote
Old July 12th, 2006, 02:12 PM   #9 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Stepping over the line?

So I wonder if there is a quick way to do the same thing with a variation of the function catrow() that would yield the same results, i.e. showing the index hierarchy of only categories with ads?
The inc_classifieds was pretty straight forward, but the function catrow looks like it is at least 4 times as long.
I copied catrow() function section to a new section in pp_inc.php and named it catrowads() for lack of anything better to name it. Now if I just knew how to tweak it to do everthing it does, but only for categories with ads.
GateKeeper is offline   Reply With Quote
Old July 12th, 2006, 03:21 PM   #10 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Got it!

Using a separate template for this process (copy categories.tmpl to whatever)
Change:
Quote:
for ( $x=0; $x < $cats['catcount']; $x++ ) {
if ( $cats['dodetails'][$x] == 1 ) {

To:
Quote:
for ( $x=0; $x < $cats['catcount']; $x++ ) {
if ( $cats['numproducts'][$x] < 1 )
continue;
if ( $cats['dodetails'][$x] == 1 ) {
GateKeeper is offline   Reply With Quote
Old July 12th, 2006, 04:19 PM   #11 (permalink)
Member
Verified Customer
 
Join Date: May 2006
Posts: 240
Lightbulb Much more than a hack!

This is turning out to be a very significant find. There have been a number of discussions about how to work with sites with a large number of categories. The two lines of code here in the categories.tmpl file along with some conditional code to determine whether the lines should be active or not, could alleviate a lot of problems for these sites.
Coupled this with a user selectable option located conveniently on the index.php or showcat.php page(s) would make this a very powerful enhancement.
Note the difference in the results of these two links:
http://www.timesharegateway.com/auct...ex.php/cat/128
and
http://www.timesharegateway.com/auct...ns.php/cat/128
Althought the script name is different, they are exact copies of each other, but call a different template (for now).
The difference in the two templates are simply
Quote:
if ( $cats['numproducts'][$x] < 1 )
continue;
just below
Quote:
for ( $x=0; $x < $cats['catcount']; $x++ ) {
as the categories.tmpl file begins its run to display the categories. The display as you will see is significantly different between the two.

With a user selectable flag (checkbox and suitable text e.g. "Show all Categories") on the template itself, and perhaps a javascript URL that activates when a change occurs in the checkbox, a user could easily acitivate the view to show all categories or only categories with ads with a single click.

Add a variable to the language file for the text of the checkbox and you have a universal solution for sites with large numbers of categories.
GateKeeper is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 random ads on forumhome? Kafi Classifieds How do I...? 3 October 20th, 2005 08:31 AM
Show ads without image on recent ads Kafi Classifieds How do I...? 2 October 19th, 2005 09:21 AM
How do I get more recent ads to show up? saunds8210 Photopost Pro How Do I...? 3 September 8th, 2005 05:08 AM
Show ads in vb3 forum. elyk Classifieds Installation & Upgrades 2 February 6th, 2005 12:28 AM


All times are GMT -5. The time now is 08:47 PM.

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