Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [patricktarget] Sort By Functionality

Quote Reply
Re: [patricktarget] Sort By Functionality In reply to
Hi,

1) Using sb in category pages won't work. You need to update the category sort order defined in Setup > Build Options. sb is only effeective for things like review.cgi / search.cgi

2) As Tandat said, this is used by the rate.cgi system. I would leave that alone. Just add a new one called "ReviewRating" or something (as a FLOAT)...then make a script to simply go through each link and get the average rating nightly:

Code:
#!/usr/local/bin/perl

use strict;
use CGI::Carp qw(fatalsToBrowser);
use lib '/path/to/admin';
use Links qw/$PLG $IN $DB/;

local $SIG{__DIE__} = \&Links::fatal;

Links::init('/path/to/admin');

my $Reviews = $DB->table("Reviews");
my $Links = $DB->table("Links");
my $sth = $Links->select( ['ID'], { isValidated => "Yes" } );
while (my $id = $sth->fetchrow) {
$Links->update( { ReviewRating => $Reviews->select( ['AVG(Review_Rating)'], { Review_LinkID => $id } )->fetchrow }, { ID => $id }) || die $GT::SQL::error;
}

Untested, but should work =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Sort By Functionality patricktarget 12296 May 13, 2013, 10:04 AM
Thread Re: [patricktarget] Sort By Functionality
Andy 12026 May 13, 2013, 10:17 PM
Thread Re: [Andy] Sort By Functionality
patricktarget 11993 May 14, 2013, 5:20 AM
Thread Re: [patricktarget] Sort By Functionality
Andy 11979 May 14, 2013, 6:34 AM
Thread Re: [Andy] Sort By Functionality
patricktarget 11978 May 14, 2013, 1:33 PM
Post Re: [patricktarget] Sort By Functionality
tandat 11914 May 14, 2013, 6:47 PM
Thread Re: [patricktarget] Sort By Functionality
Andy 11936 May 14, 2013, 11:59 PM
Thread Re: [Andy] Sort By Functionality
patricktarget 11828 May 16, 2013, 1:22 PM
Post Re: [patricktarget] Sort By Functionality
Andy 11838 May 16, 2013, 11:36 PM