How to list journals alphabetically in OJS3?

How to list journals alphabetically in OJS3?

Hi @Karthik_K

I think the only way is to reorder them manually as admin under Administration > Hosted Journals > Order.

Best,
Bozana

Hello community:

I have a similar question. It’s a little specific.

Where is the SQL query that returns the list of $journals?

I want change ORDER BY in jornaul title , similar ORDER BY journal_title ASC so that I return the list in ascending alphabetical order.

By default ojs, it returns it in the creation order. I want to change that but not manually (one by one) from Administration > Hosted Journals > Order because it is very impractical.

Regads
Cristian

It’s here https://github.com/pkp/pkp-lib/blob/master/classes/context/ContextDAO.inc.php#L158

But note that the getAll is probably used in other places as well.

I agree that on the front page it would make more sense if the titles would be in alphabetical order. We basically manually reorder the journals every time a new journal is added.

thanks. I sloved.

Add function getAll2

	/**
 * Retrieve journals en orden alfabetico.
 *
 * @param $enabledOnly true iff only enabled contexts should be included
 * @param $rangeInfo Object optional
 * @return DAOResultFactory containing matching Contexts
 */
function getAll2($enabledOnly = false, $rangeInfo = null) {
	$result = $this->retrieveRange(
		'SELECT journals.journal_id,journals.path,journals.seq,journals.primary_locale,journals.enabled  FROM journals,journal_settings WHERE journals.journal_id=journal_settings.journal_id AND journals.enabled = \'1\' AND journal_settings.setting_name=\'name\' GROUP BY journals.journal_id,journal_settings.setting_value ORDER BY journal_settings.setting_value;',
		false,
		$rangeInfo
	);		
	

	return new DAOResultFactory($result, $this, '_fromRow');
}

and modify

file pages/index/IndexHandler.inc.php

$journals = $journalDao->getAll2(true, $rangeInfo);
		$templateMgr->assign('journals', $journals);

You could probably add the custom function to a theme plugin and call it from a custom template. This way you would not have to modify the core.