Default ordering of articles in the back-end

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
grayz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Tue Dec 12, 2006 8:37 pm

Default ordering of articles in the back-end

Post by grayz » Sat Nov 16, 2013 12:13 pm

For my needs I want to have all articles listed by their ID in descending order. Default ordering is by title (alphabetical) in ascending order. To change the ordering column in Joomla 3.2:

in /administrator/components/com_content/models/articles.php
find

Code: Select all

parent::populateState('a.title', 'asc');
change to

Code: Select all

parent::populateState('a.id', 'desc');
find

Code: Select all

$orderCol = $this->state->get('list.ordering', 'a.title');
$orderDirn = $this->state->get('list.direction', 'asc');
change to

Code: Select all

$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'desc');
This will make the ordering default by ID. Still, the list of ordering option will remain with option "By Title Ascending". As a result, pressing the "Clear" button will return the ordering by title. So, to fix this:

in /administrator/components/com_content/models/forms/filter_articles.xml
find

Code: Select all

	<field
		name="fullordering"
		type="list"
		label="COM_CONTENT_LIST_FULL_ORDERING"
		description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
		onchange="this.form.submit();"
		default="a.title ASC"
		>
change to

Code: Select all

	<field
		name="fullordering"
		type="list"
		label="COM_CONTENT_LIST_FULL_ORDERING"
		description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
		onchange="this.form.submit();"
		default="a.id DESC"
		>
Personally I would like namely ordering by ID to be the default one. Can it be changed in the Joomla core files in next releases?
www.justPHP.net - HACKS for Hot Property, Custom 404 Error Pages, Templates for Joomla etc.
Developing: www.zerno.org.ua

dchristof
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Feb 20, 2011 2:10 am
Contact:

Re: Default ordering of articles in the back-end

Post by dchristof » Tue Nov 19, 2013 7:19 am

I second this request. Seems crazy we've reached Joomla 3.2 and the only way to change the article default order in the backend is still through hacking core files.. Please please whoever's reading this give us an option to change the article manager default order in the backend.

jennix
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Thu Jul 24, 2008 3:21 am

Re: Default ordering of articles in the back-end

Post by jennix » Fri Dec 06, 2013 8:02 pm

thirded. C'mon guys. There's a dorp down to change it, please give me an option to set the default

seanos
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Tue Sep 12, 2006 11:50 am

Re: Default ordering of articles in the back-end

Post by seanos » Sat Dec 14, 2013 3:11 am

Me too! This is a major problem with Joomla usability. I spend far too much time fiddling with stuff like this.

gumibear
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Thu Dec 31, 2009 8:56 pm

Re: Default ordering of articles in the back-end

Post by gumibear » Thu Jan 23, 2014 9:51 pm

Hey,

I tried this on a website on 3.1.5 and it worked fine, except that website didn't have the filter_articles.xml file, so I didn't do that step, but it wasn't needed.

I also tried it on a 3.2.1 website and it isn't working for me. the dropdown list correctly shows id descending as preselected, but the actual list is still default sorting by title ascending. if i press the clear button, it will correctly sort by id descending.


does anyone know what's happening? maybe the 3.2.1 point update broke this tweak?

grayz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Tue Dec 12, 2006 8:37 pm

Re: Default ordering of articles in the back-end

Post by grayz » Sun Feb 09, 2014 9:37 pm

@gumibear
just applied the hack to J3.2.2, it works as described in the first message.
have you modified /administrator/components/com_content/models/articles.php ?
www.justPHP.net - HACKS for Hot Property, Custom 404 Error Pages, Templates for Joomla etc.
Developing: www.zerno.org.ua

phobia82
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Feb 10, 2015 7:27 am

Re: Default ordering of articles in the back-end

Post by phobia82 » Tue Feb 10, 2015 7:31 am

This has been a request for so long, so I decided to code a simple plugin to avoid changing the core files, working from 2.5 to 3.3.6 so far:

http://extensions.joomla.org/extensions ... ault-order

gumibear
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Thu Dec 31, 2009 8:56 pm

Re: Default ordering of articles in the back-end

Post by gumibear » Tue Feb 10, 2015 4:30 pm

phobia82's tweak worked for me.. thanks so much!!

glitterchickUK
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Sun Aug 09, 2015 9:54 am

Re: Default ordering of articles in the back-end

Post by glitterchickUK » Wed Aug 12, 2015 3:46 pm

Is there anywhere "official" to request or vote on feature suggestions like this? I'd like to be able to set the default sort order for articles in the admin area too, but I'd rather not hack core files, and it's something I'm surprised isn't already in Joomla.

nugepcua
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Mon Nov 02, 2009 2:53 pm

Re: Default ordering of articles in the back-end

Post by nugepcua » Thu Apr 27, 2017 7:17 pm

how to do it in joomla 3.7? unfortunately latest update broke everything and this fix does not apply anymore. :'( :'(

User avatar
Nidzo2203
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 174
Joined: Sat Nov 21, 2009 4:52 pm
Contact:

Re: Default ordering of articles in the back-end

Post by Nidzo2203 » Fri Apr 28, 2017 3:43 pm

Comparing Articles.php from version 3.6.5 with current Joomla 3.7, there are some changes that starts from line 324 that affects ordering.

If I replace those lines of code with code from Joomla 3.6.5 Articles.php, sorting by ID descending works.
Can someone confirm is it safe to make this changes and what could be negative effects.

Current code starts from line 324 to 338:

Code: Select all

// Add the list ordering clause.
		$orderCol  = $this->state->get('list.fullordering', 'a.id');
		$orderDirn = '';

		if (empty($orderCol))
		{
			$orderCol  = $this->state->get('list.ordering', 'a.id');
			$orderDirn = $this->state->get('list.direction', 'DESC');
		}

		$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));

		return $query;
	}

Code from Joomla 3.6.5 Joomla

Code: Select all

// Add the list ordering clause.
		$orderCol = $this->state->get('list.ordering', 'a.id');
		$orderDirn = $this->state->get('list.direction', 'desc');

		if ($orderCol == 'a.ordering' || $orderCol == 'category_title')
		{
			$orderCol = 'c.title ' . $orderDirn . ', a.ordering';
		}

		// SQL server change
		if ($orderCol == 'language')
		{
			$orderCol = 'l.title';
		}

		if ($orderCol == 'access_level')
		{
			$orderCol = 'ag.title';
																						  
		}

		$query->order($db->escape($orderCol . ' ' . $orderDirn));

		return $query;
	}

ilkogruev
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Oct 03, 2010 8:47 pm
Contact:

Re: Default ordering of articles in the back-end

Post by ilkogruev » Fri May 05, 2017 7:41 pm

Is there a solution to this problem?

pethr
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Sep 13, 2005 4:55 pm

Re: Default ordering of articles in the back-end

Post by pethr » Tue May 09, 2017 6:36 pm

Amazing we still need to be hacking this. Nidzo2203's solution works for me, I can't see this breaking anything important.

dragonrider
Joomla! Ace
Joomla! Ace
Posts: 1070
Joined: Mon Aug 22, 2005 7:53 pm
Location: Ilkley, West Yorkshire, UK
Contact:

Re: Default ordering of articles in the back-end

Post by dragonrider » Mon May 15, 2017 12:34 pm

Thank You Nidzo2203, this works for me as well.

ilkogruev
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Oct 03, 2010 8:47 pm
Contact:

Re: Default ordering of articles in the back-end

Post by ilkogruev » Tue May 16, 2017 5:49 pm

I do not like the result. There are problems.
What you need is to change the order of the default articles - the latest ones are top.


Locked

Return to “Administration Joomla! 3.x”