[SOLVE]pb gk_news when the id of the section is >9

Professional Jomal template designed to be easily adaptable to all kinds of business
GK User
Mon Aug 16, 2010 2:49 pm
Hello.

When the ID of a section is >9 (i.e 2 caracters) Gk_news don't work.

I don't know PHP but I put some "echo" in files.

In the file ../modules/gk_news/helpers/db_helper.php,
in the function getSectionArray($config)

the line 37
$sectionid_clause .= ($i == count($config['sections']) - 1) ? ' s.id = '.$config['sections'][$i].' ' : ' s.id = '.$config['sections'][$i].' OR ';

returns s.id = 1 instead s.id = 14 by exemple if ID of section = 14.
Only the first caracter is take in charge.

So the SELECT in line 40 returns nothing.

Have a nice day.
Mrhappy947
User avatar
Fresh Boarder

GK User
Fri Aug 20, 2010 4:43 am
This is the solution of the bug.

In the file ../modules/gk_news/helpers/db_helper.php,
in the function getSectionArray($config)

Replace
for($i = 0; $i < count($config['sections']); $i++) {
$sectionid_clause .= ($i == count($config['sections']) - 1) ? ' s.id = '.$config['sections'][$i].' ' : ' s.id = '.$config['sections'][$i].' OR ';
}
by
if (count($config['sections'])>1) { // iteration
for($i = 0; $i < count($config['sections']); $i++) {
$sectionid_clause .= ($i == count($config['sections']) - 1) ? ' s.id = '.$config['sections'][$i].' ' : ' s.id = '.$config['sections'][$i].' OR ';
}
} else { // only one section
$sectionid_clause .= ' s.id = '.$config['sections'].' ';
}
Best regards
User avatar
Fresh Boarder


cron