[Appointments+] Wrong supplier

When I request an appointment from the frontend without selecting a specific supplier, i.e. "No preferences" in the reservation administration panel I always get a name of one of our suppliers, which is very confusing.

  • Ash
    • WordPress Hacker

    Hello Marcos

    A provider must be assigned to every appointment. So, when you don’t select any provider and select “No Preference” (that means no preferred provider, doesn’t mean no provider) then the system picks a provider and assign to that appointment.

    But you can always go to backend Dashboard > Appointments > Edit an appointment > And then you can change the provider and assign another free one :slight_smile:

    Have a nice day!

    Cheers,

    Ash

  • Carlos
    • New Recruit

    Yes, I understand. But it’s a logic that doesn’t work.

    Because I can’t distinguish between whether a user wanted to select THAT provider, or whether it was the system that assigned it.

    I need to be able to do one of two things:

    1) Or that the backend indicates that the provider was chosen by the system.

    2) Or that it can choose which provider is selected if the user chooses “No preferences”.

  • Ash
    • WordPress Hacker

    Hello Marcos

    I am sending your issue to our second level support team. I can’t promise but if it doesn’t take too much time, they will help. Please note that, they deal with more complex issues, so there might be little delay. We appreciate your patience on this.

    Have a nice day!

    Cheers,

    Ash

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Marcos !

    If you're comfortable editing files ( either through FTP, hosting file manager, editor in WordPress ) you can try this ( make sure to keep a backup first before doing any changes ):

    In wp-contentpluginsappointments-plusincludesclass-app-ajax.php – Line 523 change

    $args = apply_filters( 'appointments_post_confirmation_args', $args );

    into

    $args = apply_filters( 'appointments_post_confirmation_args', $args, $_REQUEST );

    And in your themes ( preferably the child themes ) functions.php insert this snippet

    function insert_noprovider_if_noprovider( $args, $req ) {
    if ( 0 == $req['app_provider_id'] ) {
    $args['worker'] = 0;
    }
    return $args;
    }
    add_filter( 'appointments_post_confirmation_args', 'insert_noprovider_if_noprovider', 15, 2 );

    function change_nnoprovider_name( $name, $id ) {
    if ( 0 == $id ) {
    $name = 'Please select a Provider';
    }
    return $name;
    }
    add_filter( 'app_get_worker_name', 'change_nnoprovider_name', 15, 2 );

    What this will do is, that if someone doesn't select a specific provider it will avoid setting up the first available and also show you in the list of appointments a message of 'Please Select a Provider' as seen in the screenshot.

    Tell me if this works for you! Also please note that since we're changing the 'class-app-ajax.php' file for this on an update this change will be lost. I'll inform our Devs about it though to see if we can keep this change permanently.

    If you're not comfortable changing code yourself, you can send me the information needed to make the changes for you privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question by following this example:

    Subject: "Attn: Konstantinos Xenos"

    - Admin login ( if Multisite please provide Super Admin details ):
    Admin Username:
    Admin Password:
    Login URL:

    - FTP credentials
    Hostname:
    Username:
    Password:
    Port:

    - Link back to this thread for reference
    - Any other relevant URLs -or- information regarding the issue that was not included in this thread

    Regards,

    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.