Joomla: Sort Category drop-down menu alphabetically
Usually the Category drop-down menu is first sorted by Section and then by Category Order. New Sections or Categories always appear at the end of this Order list. Either you correct the Section/Category Order every time manually or you edit the controller.php to sort the Category drop-down menu alphabetically:
../administrator/components/com_content/controller.php
// ORIGINAL Code // get list of categories for dropdown filter $query = 'SELECT cc.id AS value, cc.title AS text, section' . ' FROM #__categories AS cc' . ' INNER JOIN #__sections AS s ON s.id = cc.section ' . $filter . ' ORDER BY s.ordering, cc.ordering'; // <- REMOVE or better COMMENT $lists['catid'] = ContentHelper::filterCategory($query, $catid);
// NEW Code // get list of categories for dropdown filter $query = 'SELECT cc.id AS value, cc.title AS text, section' . ' FROM #__categories AS cc' . ' INNER JOIN #__sections AS s ON s.id = cc.section ' . $filter . // ' ORDER BY s.ordering, cc.ordering'; ' ORDER BY cc.title ASC'; // NEW $lists['catid'] = ContentHelper::filterCategory($query, $catid);
