maternal
Welcome, Guest. Please login or register.
Did you miss your activation email?

 
Advanced search

22747 Posts in 6705 Topics- by 17591 Members - Latest Member: permsk

26-02-2020 05:59:16
JOOM::GALLERY::FORUMArchiveJoomGallery 1.5 MVC - ExtensionsModulesLatest Categories Module to filter into sub categories?
Pages: [1]
Print
Author Topic: Latest Categories Module to filter into sub categories?  (Read 4788 times)
0 Members and 1 Guest are viewing this topic.
brainstorm316
Newbie
*
Offline Offline

Posts: 20


View Profile
« on: 27-10-2009 15:01:38 »

Hi,

I am trying to figure out how to modify the Latest Categories module to filter down into sub categories. So for example if my category layout was like this:

1. gallery 1
   >> sub gallery 1
   >> sub gallery 2
2. gallery 2
3. gallery 3

And I told the module to display gallery 1, it would display sub gallery 1 and 2 only.

Any advice? Thanks for any help in advance!

Kevin
« Last Edit: 30-10-2009 14:27:45 by brainstorm316 » Logged
Erftralle
Sr. Member
****
Offline Offline

Posts: 346


View Profile
« Reply #1 on: 27-10-2009 19:00:31 »

Hi,

you could modify the SQL query in the file mod_jglatestcat/helper.php to suite your needs in the following manner (line 58 and following):

Code
    $catlist = Joom_GetAllSubCategories( 1, 3 );
   $query = "SELECT ca.cid, ca.name, ca.description, ca.catpath, ca.catimage, @catimgid:=0 AS imgid"
         . " FROM #__joomgallery_catg AS ca"
         . " INNER JOIN #__joomgallery AS jg"
         . " ON ca.cid = jg.catid"
         . " WHERE ca.published = 1";
   if( count( $catlist ) > 0 ) {
     $query .= " AND ca.cid IN ( " . implode(",", $catlist ) . " )";
   }
   $query .= " AND ( isnull( jg.published ) OR jg.published = 1 )"
           . " AND ( isnull( jg.approved ) OR jg.approved = 1 )";
 

The first parameter in Joom_GetAllSubCategories should be the category ID of your "gallery 1". The second parameter determines, whether the category for "gallery 1" is included (value==3) or not (value==2).

Please don't forget to backup before.

Regards
Erftralle
Logged
brainstorm316
Newbie
*
Offline Offline

Posts: 20


View Profile
« Reply #2 on: 27-10-2009 22:02:53 »

You, my friend, deserve a medal!

Thank you!

If I would like to have multiple instances of this module, do I just need to add another "$catlist" line of code?

Regards,

Kevin
Logged
Erftralle
Sr. Member
****
Offline Offline

Posts: 346


View Profile
« Reply #3 on: 28-10-2009 11:07:24 »

Hi Kevin,

Quote
If I would like to have multiple instances of this module, do I just need to add another "$catlist" line of code?
Although I believe that this is a rhetorical question, the answer is no.

A new back end parameter should solve your problem.
You will find attached the module files to be substituted in order to have a new parameter "Root category ID".
Please don't forget to backup before.
Since I had no time for extensive testing, I would appreciate a feedback.

Regards
Erftralle
Logged
brainstorm316
Newbie
*
Offline Offline

Posts: 20


View Profile
« Reply #4 on: 28-10-2009 11:44:47 »

That is perfect, exactly what I needed.

Worked iin all instances exactly as needed, and I'm using it in 8 different modules positions, for 4 different categories, none of which need to display just the root.

Are you going to include this in your next release? I think its an incredibly powerful addition to your already existing module.

I cannot thank you enough.

regards,

Kevin
Logged
Erftralle
Sr. Member
****
Offline Offline

Posts: 346


View Profile
« Reply #5 on: 28-10-2009 12:33:20 »

Hi Kevin,

thanks for your positive feedback. Yes, I think the next release will contain this feature.

Regards
Erftralle
Logged
Pages: [1]
Print
Jump to:  

HOSTED BY SCHWARZKÜNSTLER ®

PROTECTED BY  ZB BLOCK  AND Project Honey Pot
Theme orange-lt created by panic

Bad Behavior has blocked 2713 access attempts in the last 7 days.

maternal