Events Manager
[resolved] Country dropdown in search sort incorrectly (10 posts)

  1. Beee
    Posted 3 years ago #

    Went back through the forums, but couldn't find this topic being mentioned.

    The dropdown for the selection of a country seems to be sorted by the countries shortcode instead of the country's name.

    As you can see on http://www.freerides.org/events/ Spain is listed before Finland and after Czech Republic.

    Spain's countrycode is E or ES, which should indeed go between Czech Republic (presumably CZ) and Finland (presumably FI).


  2. Beee
    Posted 3 years ago #

    WP version is 3.5, not 3.4.2

  3. agelonwl
    Posted 3 years ago #

    you can changed that by modifying template file at wp-contents/plugins/events-manager/templates/templates/events-search.php

    from location_country changed to location_name

    to use templates: http://wp-events-plugin.com/documentation/using-template-files/

  4. Beee
    Posted 3 years ago #

    Can you clarify what to change ?

    $countries = em_get_countries();
    $em_countries = $wpdb->get_results("SELECT DISTINCT location_country FROM ".EM_LOCATIONS_TABLE." WHERE location_country IS NOT NULL AND location_country != '' AND location_status=1 ORDER BY location_country ASC", ARRAY_N);
  5. Beee
    Posted 3 years ago #

    changed ORDER BY location_country to ORDER BY location_name.

    Doesn't work.

  6. Beee
    Posted 3 years ago #

    if you look at the source code, you see what I explained in my first post. It gets sorted by the country abbreviations instead of the country name.

    <option value="AU" >Australia</option>
    <option value="BE" >Belgium</option>
    <option value="CA" >Canada</option>
    <option value="CZ" >Czech Republic</option>
    <option value="ES" >Spain</option>
    <option value="FI" >Finland</option>
    <option value="FR" >France</option>
    <option value="GB" >United Kingdom</option>
    <option value="US" >United States</option>
  7. Beee
    Posted 3 years ago #

    After adding more countries, the list gets bigger and more 'messed up'. I think it can be fixed by changing the following:
    line 64 in events-search.php

    ORDER BY location_country ASC


    ORDER BY location_something ASC

    where something is a variable I don't know.
    Who has the solution ?

  8. Beee
    Posted 3 years ago #

    Just checked in phpmyadmin to which values are available.
    The country as a full name is not store in the database and therefor not sortable (afaik).

    I would recommend to insert the column which holds the full name/title from a country so it can be sorted on that field instead of on location_country.

    Hope Marcus reads this.

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    good point... will fix this asap.

  10. Beee
    Posted 3 years ago #

    Good to hear.

    Marking this topic resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic