Setting the default service to 'Select' and autoupdate if selected

Goodmorning everyone,

So regarding the 'select default service' add-on: is it possible to
1. replace the service with text like 'Choose a service'
2. no working hours available (due to no service selected)
3. as soon as a valid service is selected: automatically show available hours

Thank you all for your continuous support !!

kind regards,

Michaël

  • Predrag Dubajic

    Hey Michaël,

    Hope you're doing well :slight_smile:

    1. replace the service with text like 'Choose a service'

    You can add your own text to [app_services] shortcode by changing it to this:
    [app_services select="Choose a service"]

    2. no working hours available (due to no service selected)

    I'm not sure that I understand this one, are you looking to hide the calendar until service is selected?
    If that's the case you can change your [app_monthly_schedule] shortcode to require service or provider selected, or both.
    It would look like this:
    [app_monthly_schedule require_provider="1" require_service="1"]

    3. as soon as a valid service is selected: automatically show available hours

    You can enable auto refresh for services by changing [app_services] shortcode to this:
    [app_services autorefresh="1"]

    Hope this helps :slight_smile:

    Best regards,
    Predrag

  • Michael

    Ok, thank you again Predrag,
    So first, I added the following:

    <?php global $appointments; $appointments->load_scripts_styles(); ?>

    And then I just found out that code with double quotes is not ok:
    <?php echo do_shortcode("[app_services select="Please choose:" autorefresh="1"]"); ?>

    It's causing major trouble due to the use of double quotes. I need to replace everything with single quotes but that I can handle :wink:

    I think everything will work now but first the jQuery issue with wp_enqueue in the head, or better without the enqueue, because I still get an error on the Appointments+ regarding jQuery.

    FYI: granted access to support, that might be easier for people.

    I'll keep you posted.

    Thanks!!

    <?php echo do_shortcode("[app_services select='Please choose:' autorefresh='1']"); ?>

  • Adam Czajczyk

    Hello Michael!

    The "double quotes" issue is a common one in case of "do_shortcode()" function, indeed. The simplest solution is to use it like this:

    <?php echo do_shortcode('[app_services select="Please choose:" autorefresh="1"]'); ?>

    As you can see I kept the double quotes inside the shortcode and just changed the ones surrounding entire shortcode :slight_smile:

    I'm not however sure if you need this part at all:

    <?php global $appointments; $appointments->load_scripts_styles(); ?>

    In order for shortcodes to work the Appointments+ must be active so its styles and scripts should be loaded with the plugin. Was there any particular reason for adding that line to your template file? Have you tried to remove it (along with "double quotes" fix application)?

    Best regards,
    Adam

    • Michael

      Hi adam,

      the line about the global appointments style is because I use it in a one pager. Anyway, what I want is that:

      1. the agenda is hidden
      2. service drop down shows 'select a service'
      3. as soon as the user chooses a service, the agenda shows up for those service. I don't need a service provider.

      So, this is what I have on a (generated by appointments+) testpage:

      <table>
      <tbody>
      <tr>
      <td colspan="2">[app_my_appointments]</td>
      </tr>
      <tr>
      <td>[app_services select="Your custom text here" autorefresh="1"]</td>
      <td></td>
      </tr>
      <tr>
      <td colspan="2">[app_monthly_schedule  require_service='1']</td>
      </tr>
      <tr>
      <td colspan="2">[app_pagination]</td>
      </tr>
      <tr>
      <td colspan="2">[app_login]</td>
      </tr>
      <tr>
      <td colspan="2">[app_confirmation]</td>
      </tr>
      <tr>
      <td colspan="2">[app_paypal]</td>
      </tr>
      </tbody>
      </table>

      But still, it ain't working :slight_frown:

  • Dimitris

    Hey there Michael,

    hope you're doing good! :slight_smile:

    I just tested the exact shortcodes you shared in a test environment with TwentySeventeen theme and the web flow was as expected. Calendar wasn't visible as long as I didn't select a service.

    A small glitch here is that the dropdown select box doesn't include a default "Select a service" option on first load. In order to surpass this and use the select="Your custom text here" part in services' dropdown, please edit /wp-content/plugins/appointments/includes/shortcodes/class-app-shortcode-services.php and add the following line in line 148 (see screenshot)
    <option value=""><?php echo $args['select']; ?></option>

    If you still have issues, please consider granting us support access via WPMUDEV Dashboard plugin as described here https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-4 and let us know what's the URL of the page in question.

    Warm regards,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.