Appointments+ default to please select for service

Hi, when the list of services is shown it defaults to the first entry thus we find some users then go to the calendar and click a time without setting the correct service. Could this be default to a blank value and they need to select. Also is it possible so that when they check the service the available times is refreshed without clicking the button. Again we found that its easy to change the service and assume the calendar reflects the correct times. thanks Paul

PS: is it possible for us to change the text of 'Service' to 'Treatment'

  • Patrick
    • Support Monkey

    Hi there @Paul

    Welcome to the forums, glad to have you aboard!

    The answer to your questions is yes. :slight_smile:

    To "force" clients to select a service, you can hide the service provider selection by adding the require_service parameter to the shortcode.

    Then also add the autorefresh parameter to the service provider shortcode too so the page will automatically adjust once the provider is selected.

    If you are hiding the service provider dropdown until the service is selected using this method, it's best to not use the autorefresh parameter in the services shortcode though, as that removes the "Show available times" button and can confuse clients.

    To change the text, use the select parameter.

    So services and providers shortcodes could look like this:
    [app_services select="<h4>Choose wisely grasshopper</h4>"] [app_service_providers autorefresh="1" require_service="1"]

    Demo here:
    http://patrickcohen.net/appointments-demo-1/

    I hope this helps! And thanks for being a member :slight_smile:

  • Paul
    • WPMU DEV Initiate

    Basically the select a service drop down defaults to the first id created in the services section. I am sorting by description but it defaults to the first id. I would like the drop down box to default to a "please select" option like on most selection lists.

  • Paul
    • WPMU DEV Initiate

    I have attached a screen shot, basically when they first enter the page the lowest id is selected and thus the calendar is enabled and customers may forget to change the treatment type. Thus I would like it to default to "Please select" with the calendar hidden (or disabled) so it forces them to select an item in the list.

  • Ash
    • WordPress Hacker

    Hi @Paul

    Would you please go to /plugins/appointments/includes/class_app_shortcodes.php line no 1199 to 1225 and replace with the following:

    $s .= '<option selected="selected" value="">Please select</option>';
    		if ( $services ) {
    			foreach ( $services as $service ) {
    				$service_description = '';
    				// Check if this is the first service, so it would be displayed by default
    				if ( isset( $_REQUEST['app_service_id'] ) && $service->ID == $appointments->service ) {
    					$d = '';
    					$sel = ' selected="selected"';
    				}
    				else {
    					$d = ' style="display:none"';
    					$sel = '';
    				}
    				// Add options
    				$s .= '<option value="'.$service->ID.'"'.$sel.'>'. stripslashes( $service->name ) . '</option>';
    				// Include excerpts
    				$e .= '<div '.$d.' class="app_service_excerpt" id="app_service_excerpt_'.$service->ID.'" >';
    				// Let addons modify service page
    				$page = apply_filters( 'app_service_page', $service->page, $service->ID );
    				switch ( $description ) {
    					case 'none'		:		break;
    					case 'excerpt'	:		$service_description .= $appointments->get_excerpt( $page, $thumb_size, $thumb_class, $service->ID ); break;
    					case 'content'	:		$service_description .= $appointments->get_content( $page, $thumb_size, $thumb_class, $service->ID ); break;
    					default			:		$service_description .= $appointments->get_excerpt( $page, $thumb_size, $thumb_class, $service->ID ); break;
    				}
    				$e .= apply_filters('app-services-service_description', $service_description, $service, $description) . '</div>';
    			}
    		}

    Please let us know if that works for you.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Hi @Paul

    Please add the following code in your theme's functions.php file:

    add_action('wp_head', 'hide_calendar');
    function hide_calendar() {
      if( ! isset( $_REQUEST['app_service_id'] ) ) {
        ?>
        <style>
        .appointments-wrapper{display: none}
        </style>
        <?php
      }
    }

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • Paul
    • WPMU DEV Initiate

    Yes that worked thank you, I just made a small adjustment as the legend was still showing;

    `add_action('wp_head', 'hide_calendar');
    function hide_calendar() {
    if( ! isset( $_REQUEST['app_service_id'] ) ) {
    ?>
    <style>
    .appointments-wrapper{display: none}
    .appointments-legend{display:none}
    </style>
    <?php
    }
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.