This works! Thank you.
The reason I wanted the subcategory drop down list was that the subcategories for my categories actually are just a list of details about the category item. :)
Let's see if I took you code and made it to list aubcategories only would this work:
sub {
my ($all_ids,@list,$output);
my $tags = shift;
my $id = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.ID', 'Category.Name','Category.Full_Name'] );
while (my ($cat_id,$name,$full_name) = $sth->fetchrow_array) {
$all_ids = $DB->table('Category')->children($cat_id);
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY Add_Date DESC"); #Change this to change the order
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', \@$all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
push @list, $link;
}
foreach my $name (@list) {
my $detailed_url = "$CFG->{build_cgi_url}/$name";
$output .= qq~<option value="$detailed_url">$link->{'Full_Name'}~;
}
}
return $output;
}
Don't think this will work.... would it be foreach $cat_id instead?
The reason I wanted the subcategory drop down list was that the subcategories for my categories actually are just a list of details about the category item. :)
Let's see if I took you code and made it to list aubcategories only would this work:
sub {
my ($all_ids,@list,$output);
my $tags = shift;
my $id = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.ID', 'Category.Name','Category.Full_Name'] );
while (my ($cat_id,$name,$full_name) = $sth->fetchrow_array) {
$all_ids = $DB->table('Category')->children($cat_id);
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY Add_Date DESC"); #Change this to change the order
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', \@$all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
push @list, $link;
}
foreach my $name (@list) {
my $detailed_url = "$CFG->{build_cgi_url}/$name";
$output .= qq~<option value="$detailed_url">$link->{'Full_Name'}~;
}
}
return $output;
}
Don't think this will work.... would it be foreach $cat_id instead?