Keyword

How to order items by Finish publishing date

  • Federica
  • Federica's Avatar Topic Author
  • Offline
  • New Member
More
12 years 9 months ago #60796 by Federica
Hi everyone!

I need to order by "END of publishing" the list of the items in the backend.

I can order item by "Created" (START publishing), but I need to order my items also by "Finish publishing"...

Which files I have to modify? :huh:

I hope someone could help me!
Thanks

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #60797 by Justin Thomas
Replied by Justin Thomas on topic Re: How to order items by Finish publishing date
I have a solution for you.

Open ROOT\components\com_k2\models\itemlist.php

Around line 229 find the

//set ordering


Find one of the options that you will NOT use. I chose
case 'alpha'

change the code to
$orderby = "i.publish_down';

Now in your administration section go to the category you want to change the order for and choose the option you changed (in my case Title Alpha...).

This should work.

Please Log in or Create an account to join the conversation.

  • Federica
  • Federica's Avatar Topic Author
  • Offline
  • New Member
More
12 years 7 months ago #60798 by Federica
Hi Justin,
thanks for your reply, your solution did not work but it was helpful for me (with "i.publish_down").
I try to solve this problem and now I found a solution!! :)

in ROOT/administrator/components/com_k2/views/items/tmpl/default.php

I changed (at around line 81):

<th>
<?php echo JHTML::_('grid.sort', 'K2_LAST_MODIFIED_BY', 'moderator', @$this->lists, @$this->lists); ?>
</th>

with:

<th>
<?php echo JHTML::_('grid.sort', 'K2_FINISH_PUBLISHING', 'i.publish_down', @$this->lists, @$this->lists); ?>
</th>

and then I changed (at around line 162):

<td>
<?php if($this->user->gid>23): ?>
<a href="<?php echo JRoute::_('index.php?option=com_users&task=edit&cid[]='.$row->modified_by); ?>"><?php echo $row->moderator; ?></a>
<?php else: ?>
<?php echo $row->moderator; ?>
<?php endif; ?>
</td>


with:

<td class="k2Date">
<?php echo ($row->publish_down == $this->nullDate) ? JText::_('K2_NEVER') : JHTML::_('date', $row->publish_down , $this->dateFormat); ?>
</td>

and it WORKS!!!

In this case I chose to change the option "modified by" but you can choose what you want!

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #60799 by Justin Thomas
Replied by Justin Thomas on topic Re: How to order items by Finish publishing date
Whoops, silly me. I was so happy to have answered my problem that I forgot to re-read your OP. Well, now we have posted solutions for both back AND front end ;)

Nice work

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #60800 by palos
Nothing above worked for me :(

- No any Category Ordering works
- Impossible to override the "ordering by ID"

It was sadly buggy before* also but I am afraid that upgrading Joomla from 1.7.2 >2.5.1>2.5.2>2.5.3 confused everything with the database and K2 .

*the only way was worked - putting the same publishing date to the item as the creation date and choosing "Most recent first (by date published)" at Other layout options>Item ordering

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #60801 by Dominic Reid
Replied by Dominic Reid on topic Re: How to order items by Finish publishing date
Hi there,

I'm trying to implement this idea so that I can get some kind of event list that orders itself by finish publishing date.

The idea being that if people put the day AFTER the event expires as finish publishing, then if I could get the category to order itself by the finish publishing date (nearest first) the articles would clear themselves at midnight and the next days events would be at the top.

I tried the solution here but it didn't work, am I trying to something different perhaps?

It would be good not to have to disturb the other choices in the dropdown selector too.

Any ideas?

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #60802 by Dominic Reid
Replied by Dominic Reid on topic Re: How to order items by Finish publishing date
Aha - a pesky double quotation mark here $orderby = "i.publish_down'; was the reason it wasn't working for me Draftvader , so use this code instead and it works:

$orderby = 'i.publish_down';

Thanks for the solution - it'd be really handy to have this in the source code.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum