Colin, tks for solution. This also solves a even more serious problem. When you set to fetch sub-categories, if you put 2 content modules in the same page, it only takes the articles of the last first category module.
Anyhow, taking the static array out, also solve the above problem.
Great job!
Kormann said:Thank you man! It worked flawessly! :D
Colin Salomons said:You have to edit function getCategoryChilds in components/com_k2/models/itemlist.php. The problem is that static array. Here is what I replaced it with: function getCategoryChilds($catid, &$array=array()) {
$user = &JFactory::getUser();
$aid = $user->get('aid');
$db = &JFactory::getDBO();
$query = "SELECT * FROM #__k2_categories WHERE parent={$catid} AND published=1 AND trash=0 AND access<={$aid} ORDER BY ordering ";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
array_push($array, $row->id);
if (K2ModelItemlist::hasChilds($row->id)) {
K2ModelItemlist::getCategoryChilds($row->id, $array);
}
}
return $array;
}