Support

Home Forums Events Calendar Add-on Calendar Sorting Issue

Calendar Sorting Issue

Posted: August 21, 2012 at 9:49 am


rjones

August 21, 2012 at 9:49 am

We are using the calendar module and this code on the page to display the calendar in list format:

[EVENT_ESPRESSO_CATEGORY event_category_id=”kids_classes” show_recurrence=true]

The sort order is off and not listing the event by start_date.

See here:
http://www.kempcenter.org/?page_id=167

Is we can do to get the start_date to rule in the ordering?


Chris Reynolds

  • Support Staff

August 21, 2012 at 3:07 pm

Try using

[EVENT_LIST category_identifier="kids_classes" show_recurrence="true" order_by=date(start_date),id]


rjones

August 22, 2012 at 10:19 am

Thanks for the reply!

I tried that and it didn’t work. There’s no difference. You can see it here:

http://www.kempcenter.org/?page_id=167


Chris Reynolds

  • Support Staff

August 22, 2012 at 10:46 am

It looks like it’s working for me. The events display by start date:

Elementary Art- September 2012
September 4, 2012–September 25, 2012

Tiny Picasso- September 2012
September 6, 2012–September 27, 2012

Advanced Elementary Art- September 2012
September 6, 2012–September 27, 2012

Youth Drawing- September 2012
September 10, 2012–September 24, 2012

Youth Drawing- October 2012
October 1, 2012–October 31, 2012

Is there something else that I’m missing?


rjones

August 22, 2012 at 12:38 pm

Actually – I was working on the code in your module. That is what you saw the results of. In the uploads\espresso\templates\event-list.php file the line 98 is commented out:

//$sql .= $order_by != ‘NULL’ ? ” ORDER BY ” . $order_by . ” ASC ” : ” ORDER BY date(start_date), id ASC “;

This is the file (https://gist.github.com/3165268) that I was provided for another issue we had regarding recurring events.

When I un-comment out the line above, you see the results that you mentioned.

Upon further testing, it appears that the order_by attributes never gets passed to this function. I am currently researching why this is. in the meanwhile, I am hard coding $order_by so I can temporarily get past this issue.


rjones

August 22, 2012 at 12:42 pm

To be clear…

I added / modified the code in events-list.php, line 98 to be:

$order_by = “date(start_date) DESC,id”;
$sql .= $order_by != ‘NULL’ ? ” ORDER BY ” . $order_by . ” ASC ” : ” ORDER BY date(start_date), id ASC “;

That fixed it – albeit a bit ugly.


Chris Reynolds

  • Support Staff

August 22, 2012 at 12:52 pm

Okay, I’ll make a ticket so we can look at it for the next update. I seem to recall this issue (the order by parameter not being used) but I thought it got fixed.


rjones

August 22, 2012 at 1:01 pm

It probably did get fixed. We’re using the following versions:

Event Espresso 3.1.24.1.P (with a modified event-list.php file – see above)
Event Espresso – Calendar 2.0.1
Event Espresso – Recurring Events 1.1.7

We haven’t updated because the last time we tried things broke. We backed the version down so we could go live quickly.


Chris Reynolds

  • Support Staff

August 22, 2012 at 2:00 pm

I see. Most likely what broke is the function that controls the social media buttons which became an action instead of a separate function. It’s just one line of code on your display templates and can be removed entirely if you aren’t using that add-on.


Seth Shoultes

  • Support Staff

August 30, 2012 at 1:07 am

I think I have the sorting fixed now. I added a new shortcode parameter. Just needs to be tested.


rjones

August 30, 2012 at 10:24 am

If there’s anything I can do to help test just let me know.

The support post ‘Calendar Sorting Issue’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Status: closed

Updated by  rjones 8 years, 6 months ago ago

Topic Tags

Tagged: , , ,

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!