Wie so oft findet man über einen komplizierten Weg plötzlich einen einfachen! Wir brauchen das Extrafeld "gid" gar nicht. Damit entfällt der Eingriff in MYSQL. Lediglich die Function muss ausgetauscht werden. Nur die vergebene "Gruppen ID" wird zum Gruppieren im Code benutzt.
Code: Select all
function _getSectionListQuery( $aid, $params ) {
$display_sections = $params->get('display_sections', '');
if ( $display_sections != '' ) {
$section_ids_where = " AND s.id IN (".$display_sections.")";
} else {
$section_ids_where = '';
}
$hide_sections = $params->get('hide_sections', '');
if ( $hide_sections != '' ) {
$section_ids_not_where = " AND s.id NOT IN (".$hide_sections.")";
} else {
$section_ids_not_where = '';
}
$GruppenID = $_GET["group"];
$wheres[] = " s.published = 1";
$wheres[] = " cc.published = 1";
if ( $GruppenID != 0 ) {
$wheres[] = " s.id = $GruppenID";
$wheres[] = " cc.section = $GruppenID";
$Gruppieren=" GROUP BY $GruppenID";
} else {
$wheres[] = " s.id = cc.section";
$Gruppieren=" GROUP BY s.id";
}
if ($aid !== null) {
$wheres[] = "s.access <= " . (int) $aid;
}
$query = " SELECT s.id, s.title, s.alias, COUNT(cc.id) AS numcat, '' AS categories"
. " FROM #__phocadownload_sections AS s, #__phocadownload_categories AS cc"
. " WHERE " . implode( " AND ", $wheres )
. $section_ids_where
. $section_ids_not_where
. $Gruppieren
. " ORDER BY s.ordering";
return $query;
}
Wolfgang