Changing the default option in 'Please Select a Service' dropdown

Hi all,

I've got three service options for a user to choose from:

- 20 minute consultation
- 1 1/2 hour session
- 2 hour session

I'd also like the calendar hidden until the user selects the service they want.

I've edited class_app_shortcodes.php to add an extra <option> that says 'Please select a service', but everytime I select a service from the dropdown list, the page refreshes and it reverts back to 'Please select a service' (because that line is <option value="0" selected="selected">:wink:.

Have any of you lovely, clever people have an idea of how I can fix this?

This is a snippet from class_app_shortcodes.php, starting on line 1238:

$s .= '<select name="app_select_services" class="app_select_services">';
		$s .= '<option value="0" selected="selected">Please select a service:</option>';
		if ($services) {
			foreach ($services as $service) {
				$service_description = '';
				// Check if this is the first service, so it would be displayed by default
				if ($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>';
		$s .= '</select>';

I /* commented out */ the if ($service->ID == $appointments->service) { $d = ''; $sel = 'selected="selected"'; } else ... } as it's in the foreach loop and if I leave it in I get:

Please select a service:
20 minute consultation
Please select a service:
1 1/2 hour session
Please select a service:
2 hour session

Any help will be much appreciated :slight_smile:

    • Karina

      Hi Kasia,

      Thanks for your swift response. The empty_option="Please, select" isn't working for me sadly.

      [app_services select="Book a Session" autorefresh="1" empty_option="Please, select"]
      [app_pagination month="1"]

      Above is the current shortcode setup I've got. I only have one service provider, so I don't need the user to choose one. Just the services!

      Thanks for the jQuery function, too :slight_smile:

  • Rupok

    Hi Karina

    I hope you had a wonderful day.

    I'll suggest you not to edit the core files because when you update the plugin, all your custom codes will be gone and you have to re-write those fixes. Even if you have to modify anything, use hooks if possible.

    It seems like the 'empty_option' shortcode is not working and it's a bug. I'm reporting this bug to our developer and I believe, he will come up with a solution very soon. Moreover, the [app_services] doesn't have a 'empty_option' attribute. So I'll request our developer to add this attribute in [app_services] shortcode. And I believe, that will solve your problem.

    Please keep in mind that our developers work round the clock and has to deal with lots of critical issues. So it may take a little while before they give us the fix.

    Have a nice day. Cheers!