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

Re: [VishalT] How to list/display of Sub Categories for any Detail Page.

Quote Reply
Re: [VishalT] How to list/display of Sub Categories for any Detail Page. In reply to
Ah ok - thats pretty simple then. The other global won't work, but its easy to change it specifically for this task:

get_parent_categories

Code:
sub {

my $cat_id = $_[0];

my $father_id = $DB->table("Category")->select( ['FatherID'], { ID => $cat_id } )->fetchrow || '';
my $sth = $DB->table("Category")->select( { FatherID => $father_id } ) || die $GT::SQL::error;

my @cats;
while (my $cat = $sth->fetchrow_hashref) {

next if $cat->{ID} == $cat_id;

$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};

push @cats, $cat;
}

return { parent_cat_loop => \@cats };


}

Then call with:

Code:
<%get_parent_categories($ID)%>
<%loop parent_cat_loop %>
....
<%endloop%>

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 How to list/display of Sub Categories for any Detail Page. VishalT 7617 Jan 7, 2020, 10:34 PM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 7466 Jan 7, 2020, 11:42 PM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 7464 Jan 7, 2020, 11:50 PM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 7465 Jan 7, 2020, 11:51 PM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 7455 Jan 8, 2020, 12:03 AM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 7463 Jan 8, 2020, 12:05 AM
Post Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 7441 Jan 8, 2020, 12:22 AM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 6364 Oct 31, 2020, 2:55 PM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 6363 Nov 1, 2020, 12:01 AM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 6357 Nov 1, 2020, 10:41 AM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 6347 Nov 1, 2020, 10:28 PM
Post Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 6304 Nov 2, 2020, 1:22 PM