
May 8, 2003, 7:29 AM
User (205 posts)
May 8, 2003, 7:29 AM
Post #27 of 44
Views: 9245
Hi Essam,
So we must create ShowSubCategoryLinks in Category Table[/url] as column??? then create a global called subcategory_links with:
sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~<li><a href="$CFG->{db_cgi_url}/jump.cgi?ID=$link->{ID}">$link->{'Title'}~;
}
return $output;
}
Le me know and thanks in advance
Antoine
So we must create ShowSubCategoryLinks in Category Table[/url] as column??? then create a global called subcategory_links with:
sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~<li><a href="$CFG->{db_cgi_url}/jump.cgi?ID=$link->{ID}">$link->{'Title'}~;
}
return $output;
}
Le me know and thanks in advance
Antoine
Sep 17, 2003, 2:27 AM
Novice (34 posts)
Sep 17, 2003, 2:27 AM
Post #29 of 44
Views: 9104
Hi all,
How can I change slighly the global to have the link listed only if it match an additional criteria
eg :
I have several link types and I want the global to list only the links in subcaterories that have its additional field "link_type" equal to 1 for example
???
Thank in advance,
Fabrice
How can I change slighly the global to have the link listed only if it match an additional criteria
eg :
I have several link types and I want the global to list only the links in subcaterories that have its additional field "link_type" equal to 1 for example
???
Thank in advance,
Fabrice
Sep 17, 2003, 1:20 PM
Veteran (1921 posts)
Sep 17, 2003, 1:20 PM
Post #30 of 44
Views: 9202
If the field is in your Links table, you can just add an extra condition to the condition statement.
sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats, 'link_type', '=', '1');
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~<li><a href="$CFG->{db_cgi_url}/jump.cgi?ID=$link->{ID}">$link->{'Title'}</a>~;
}
return $output;
}
sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats, 'link_type', '=', '1');
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~<li><a href="$CFG->{db_cgi_url}/jump.cgi?ID=$link->{ID}">$link->{'Title'}</a>~;
}
return $output;
}
May 18, 2004, 1:29 PM
Novice (12 posts)
May 18, 2004, 1:29 PM
Post #32 of 44
Views: 8968
Hi,
I did everything shown below, except I changed it to: $output .= Links::SiteHTML::display ('link', $link);
Then I went in and changed Show SubCategory Links to "YES" where appropriate.
It works fine in the categories that only have 3 categories deep, but others with more than 3 categories deep don't display ANY sub category listing at all (not even on the first levels).
Am I totally missing something here? Or what...
-Di
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I did everything shown below, except I changed it to: $output .= Links::SiteHTML::display ('link', $link);
Then I went in and changed Show SubCategory Links to "YES" where appropriate.
It works fine in the categories that only have 3 categories deep, but others with more than 3 categories deep don't display ANY sub category listing at all (not even on the first levels).
Am I totally missing something here? Or what...
-Di
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Jul 16, 2005, 3:48 AM
User (90 posts)
Jul 16, 2005, 3:48 AM
Post #33 of 44
Views: 8966
I have been using this global for the last year (for example my t-shirt category) and it is great. However, the sort order is by title and I would like it to use the sort order as defined in build_sort_order_category (i.e. Hits DESC,isPopular DESC,isNew DESC,Title). Is this possible? TIA
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Jul 18, 2005, 11:48 PM
User (90 posts)
Jul 18, 2005, 11:48 PM
Post #35 of 44
Views: 9132
Thanks Laura - not sure where to add it - tried a few places and got errors - which line should it gone on? My global currently is:
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}Thanks!
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Code:
sub { my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Jul 19, 2005, 4:13 AM
Veteran (1921 posts)
Jul 19, 2005, 4:13 AM
Post #36 of 44
Views: 8815
This should work:
sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options ("ORDER BY $CFG->{build_sort_order_cat}");
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}
sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options ("ORDER BY $CFG->{build_sort_order_cat}");
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}
Jul 19, 2005, 4:56 AM
User (90 posts)
Jul 19, 2005, 4:56 AM
Post #37 of 44
Views: 8969
Thanks Laura but I get this error:
A fatal error has occured:
Your help is really appreciated.
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Quote:
A fatal error has occured:
Can't call method "fetchrow_hashref" on an undefined value at (eval 27) line 13.
Your help is really appreciated.
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Jul 19, 2005, 5:20 AM
User (90 posts)
Jul 19, 2005, 5:20 AM
Post #39 of 44
Views: 9015
A fatal error has occured:
Please enable debugging in setup for more details.Stack Trace ======================================
[REMOVED]
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Can't call method "fetchrow_hashref" on an undefined value at (eval 27) line 13.
Please enable debugging in setup for more details.Stack Trace ======================================
[REMOVED]
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Last edited by:
IndigoClothing: Jul 19, 2005, 5:39 AM
Jul 19, 2005, 5:40 AM
User (90 posts)
Jul 19, 2005, 5:40 AM
Post #42 of 44
Views: 8848
Hi,
Using 2.2.0 still. Any other questions just give me a shout.
Alex
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Using 2.2.0 still. Any other questions just give me a shout.
Alex
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Last edited by:
IndigoClothing: Jul 19, 2005, 5:40 AM
Jul 19, 2005, 5:54 AM
Veteran (1921 posts)
Jul 19, 2005, 5:54 AM
Post #43 of 44
Views: 8863

If you use this:
$link_db->select_options ("ORDER BY $CFG->{build_sort_order_category}") if ($CFG->{build_sort_order_category});
you shouldn't get the error message even if it doesn't work.
Jul 20, 2005, 12:45 AM
User (90 posts)
Jul 20, 2005, 12:45 AM
Post #44 of 44
Views: 8886
Laura,
No worries - Thank you so much - that should really help visitors to my site
Hope you are enjoying the summer - rather grey in London today.
Alex
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
No worries - Thank you so much - that should really help visitors to my site

Hope you are enjoying the summer - rather grey in London today.
Alex
Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery