How do I sort service providers by last name?

How can I sort the service providers by last name? See http://www.officials.wisconsin-web-writer.info/make-an-appointment/. If you scroll down in the service provider list you will see that it isn’t alphabetical (you have to go all the way down).

If you send code, send it all please. I found a similar question and added this question to that one. (See it here: https://wpmudev.com/forums/topic/edit-order-of-services-in-dropdown-menu#post-762804) However the code given creates a fatal error. I am sure I am missing something.

  • wiscwebwriter
    • Flash Drive

    I figured out how to do this on the page. I needed to put [app_services order_by=”name”] in the page where the list of service providers is shown.

    How do I do this same thing on the service provider lists in the Exception and Working Hours settings?

  • Michael Bissett
    • Recruit

    Hey @wiscwebwriter, hope you’re doing well today! :slight_smile:

    In order to sort the names like that inside the admin interface, this would require some custom coding (which would get erased on an update to the plugin), as it’s presently designed to display each provider by the ID assigned to him.

    You may need to hire someone to develop this for you, but I can call in our second line support staff, to see if they have a quick way of handling this for you. Like I said earlier though, it would be wiped out on an update to the plugin, so you’d have to note the changes made.

    Please advise,

    Michael

  • Michael Bissett
    • Recruit

    Hey @wiscwebwriter, thanks for your patience here! :slight_smile:

    In that case, I’ll call in our second level support staff, to see what they have to say about this.

    Please note, as SLS also develops plugins, and as there is a higher load currently (due to one of them being ill), there may be a slight delay, though they will respond as quickly as possible.

    Hope you’re having a great weekend! :slight_smile:

    Kind Regards,

    Michael

  • Jose
    • Bruno Diaz

    Hi there @wiscwebwriter,

    This is not possible out of the box, but you can achieve it by doing some simple changes to the templates.

    In this file:

    wp-content/plugins/appointments/includes/templates/app-admin-settings-exceptions.php

    Change line 11 from this:

    $workers = $appointments->get_workers();

    To this:

    $workers = $appointments->get_workers('name');

    In this other file:

    wp-content/plugins/appointments/includes/templates/app-admin-settings-working_hours.php

    Change line 7 from this:

    $workers = $wpdb->get_results( "SELECT * FROM " . $appointments->workers_table . " " );

    To this:

    $workers = $appointments->get_workers('name');

    The down side on this change is that you would need to replicate the changes if you update the plugin.

    I’ll try to introduce some modifications to the production version in order to make this hookable.

    Please let me know if it works fine for you.

    Thanks,

    Jose