TOPIC: Ordering of articles

Ordering of articles 11 years 2 months ago #301

  • thellie
  • thellie's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 3
  • Karma: 0
Is it possible to adapt so that the articles are in alphabetical order, or preferably, ordered according to their order set in the back-end?

My articles in the minitab are such that I would like an overview article to always sit at the top of the list on each tab.

thanks :)

btw Joomla 1.7
The administrator has disabled public write access.
The following user(s) said Thank You: makcimka

Re: Ordering of articles 11 years 2 months ago #302

  • linh_omg
  • linh_omg's Avatar
  • OFFLINE
  • Moderator
  • Posts: 908
  • Thank you received: 568
  • Karma: 25
thellie wrote:
Is it possible to adapt so that the articles are in alphabetical order, or preferably, ordered according to their order set in the back-end?

My articles in the minitab are such that I would like an overview article to always sit at the top of the list on each tab.

thanks :)

btw Joomla 1.7

Hi thellie,
In the back-end, at this module edit page, there is parameters area at the right side. You'll find the "order by" options.

Thanks for using our products!
If you need to send us FTP access / host access, administrator access or any private information:
services(at)omegatheme(dot)com or drop a ticket www.omegatheme.com/member/
The administrator has disabled public write access.
The following user(s) said Thank You: makcimka

Re: Ordering of articles 11 years 2 months ago #305

  • thellie
  • thellie's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 3
  • Karma: 0
Yes, I have seen them already, but the order options are limited to ones related to 'Recently...' and 'Most hits..'

I would like one based on the parameters I mentioned, but these options are not available.

Which files would I need to hack to add these options myself? I'm fairly comfortable in PHP and MySQL, so am not worried about giving it a go.
The administrator has disabled public write access.
The following user(s) said Thank You: makcimka

Re: Ordering of articles 11 years 2 months ago #306

  • linh_omg
  • linh_omg's Avatar
  • OFFLINE
  • Moderator
  • Posts: 908
  • Thank you received: 568
  • Karma: 25
thellie wrote:
Yes, I have seen them already, but the order options are limited to ones related to 'Recently...' and 'Most hits..'

I would like one based on the parameters I mentioned, but these options are not available.

Which files would I need to hack to add these options myself? I'm fairly comfortable in PHP and MySQL, so am not worried about giving it a go.

Hi,
Great to hear that! You can find the file named "helper.php" in "modules/mod_otminitabs/".

Goodluck and thanks for using our products!
If you need to send us FTP access / host access, administrator access or any private information:
services(at)omegatheme(dot)com or drop a ticket www.omegatheme.com/member/
Last Edit: 11 years 2 months ago by linh_omg.
The administrator has disabled public write access.
The following user(s) said Thank You: makcimka

Re: Ordering of articles 11 years 2 months ago #309

  • thellie
  • thellie's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 3
  • Karma: 0
Ok, thanks.

Below is the amended code, but I had to manually change the ordering parameter in the #_modules table, to the new option (o_asc), as I couldn't work out where the MySQL table is updated. I also added the option to the en-GB files in the language folder, but as the MySQL update doesn't work, this is currently redundant.
        // Set ordering
        $order_map = array(
            'm_dsc' => 'a.modified DESC, a.created',
            'mc_dsc' => 'CASE WHEN (a.modified = '.$db->quote($db->getNullDate()).') THEN a.created ELSE a.modified END',
            'c_dsc' => 'a.created',
            'p_dsc' => 'a.publish_up',
            'h_dsc' => 'a.hits',
            'o_asc' => 'a.ordering'
        );
        
        $ordering = JArrayHelper::getValue($order_map, $params->get('ordering'), 'a.publish_up');
        IF($order_map='o_asc') {$dir = 'ASC';} ELSE {$dir = 'DESC';}
        $model->setState('list.ordering', $ordering);
        $model->setState('list.direction', $dir);
The administrator has disabled public write access.
The following user(s) said Thank You: makcimka

Re: Ordering of articles 11 years 1 week ago #857

  • morten_lysgaard
  • morten_lysgaard's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 1
  • Karma: 0
Hi

I have tried to change my code to

// Set ordering
$order_map = array(
'm_dsc' => 'a.modified DESC, a.created',
'mc_dsc' => 'CASE WHEN (a.modified = '.$db->quote($db->getNullDate()).') THEN a.created ELSE a.modified END',
'c_dsc' => 'a.created',
'p_dsc' => 'a.publish_up',
);
$ordering = JArrayHelper::getValue($order_map, $params->get('ordering'), 'a.publish_up');
IF($order_map='p_dsc') {$dir = 'ASC';} ELSE {$dir = 'DESC';}

But the ELSE function doesn't seem to work....


Best regards
Morten
The administrator has disabled public write access.
The following user(s) said Thank You: makcimka
Time to create page: 0.105 seconds