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

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

Quote Reply
Re: [Andy] How to list/display of Sub Categories for any Detail Page. In reply to
Andy wrote:
Hi,

Try the modified version above

Cheers

Hey Andy,

Right now I am using this global:

Code:
sub {
# first work out the category this link is in. If its in multiple cats, we just grab the first one

my $cat_id = $DB->table("CatLinks")->do_query(qq|SELECT CategoryID FROM glinks_CatLinks WHERE LinkID = $_[0]|)->fetchrow || '';
if ($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) {

$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 };
}


}

This displays category names as desired on the Detailed page. However, it does not show other category names on the Category page.

i.e. For example on the Dallas Category page, I am thinking of showing below in the sidebar:
-----------------------------
Near-by Popular Locations:
Austin
Houston
San Antonio
El Paso
-----------------------------

In this example: along with Dallas, Austin, Houston, San Antonia, El Paso, categories are part of 'Texas' Sub-categories. (i.e. for the State of Florida, it would show near-by locations based in Sub Categories in Florida & so on for other states)


Any idea how can this work?

Vishal
-------------------------------------------------------
Subject Author Views Date
Thread How to list/display of Sub Categories for any Detail Page. VishalT 7615 Jan 7, 2020, 10:34 PM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 7464 Jan 7, 2020, 11:42 PM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 7462 Jan 7, 2020, 11:50 PM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 7463 Jan 7, 2020, 11:51 PM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 7453 Jan 8, 2020, 12:03 AM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 7461 Jan 8, 2020, 12:05 AM
Post Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 7438 Jan 8, 2020, 12:22 AM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 6362 Oct 31, 2020, 2:55 PM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 6361 Nov 1, 2020, 12:01 AM
Thread Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 6355 Nov 1, 2020, 10:41 AM
Thread Re: [VishalT] How to list/display of Sub Categories for any Detail Page.
Andy 6344 Nov 1, 2020, 10:28 PM
Post Re: [Andy] How to list/display of Sub Categories for any Detail Page.
VishalT 6301 Nov 2, 2020, 1:22 PM