Support

Home Forums Event Espresso Premium sorting by categorie and date

sorting by categorie and date

Posted: October 21, 2013 at 7:02 am


Nadir Al-Badri

October 21, 2013 at 7:02 am

Hello, i try to sort my list view by date with this shortcode:
[EVENT_LIST category_identifier=catnamexyz show_expired=true order_by=start_date sort=DESC]
The DES or ASC attribut has actullay an influence but the dates are totaly mixed up… How can i solve this?


Tony

  • Support Staff

October 21, 2013 at 7:34 am

Hi Nadir,

When you say the dates are mixed up, how so?

Using the shortcode you provided locally worked with the events sorted by event start date.

Is it possible for you post a link to the page?


Nadir Al-Badri

October 24, 2013 at 7:48 am

Hi, i found out that due to a modification to the date picker to european format (dd-mm-yyyy) the dates became mixed up. I revertred that for now, but i am sure its possible to fix it in a different way. Is thete a special reason why the mysql field type of the date field is not set to format “date” in the db ?


Sidney Harrell

October 24, 2013 at 12:32 pm

The reason is legacy code. For us to go in and change it now would cause a lot of breakage for our customers that have EE running production sites. We recognised the problem of legacy code over a year ago and began work on EE 4.0, which is totally rewritten from the ground up (uses unix timestamps instead of dates in the db).
One solution would be to modify insert_event.php and update_event.php to take the modified date format the date picker is producing and change it to the Y-m-d format before storing it in the DB, so that it is again sortable as a string. That would be my preference, since there may be places in the rest of the code that depends on the date being stored in the db in that format.
Another solution would be to do a custom array sorting on the results of the db query, ie. convert the custom time format stored in the db into a unix timestamp and use that as the key to build a new array of the events. That way when the new array of events is iterated over, it will be in order.


Nadir Al-Badri

October 29, 2013 at 4:14 am

Ok, thanks for the update.

The support post ‘sorting by categorie and date’ 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.

Event Espresso