different "time base" for each service on appointments+ wpmudev plugin

Hi! PLease:
I really need a different "time base" for each service on appointments+
PLease, how can I do that? I think it is not a featured, Can you develope it?
Thanks!

  • doble

    HI Hakan! Yes, sure :slight_smile:

    It is a sports center about golf and tennis:

    > The golf tee times are every 10 minutes because people go to the course and everybody plays in the same ground (but different holes...)
    > The tennis times are every hour because 2 players goes to the court and nobody can play in there since the next hour.

    So, I need diferent time bases schedules for services.

    Please, how can I do that?
    Sorry, I´m new on wpmudev... where can I find the appointments+ plugin manual?
    Really Thanks!!!

  • Hakan

    Hi,

    Appointments+ is for one-to-one appointments, that is, single service providers serving single clients.

    You are trying to use it as a booking system. As this is not the intended usage, it may have some limitations for you, or you may try to customize as @Vaughan noted.

    The easiest solution is setting time base as 10 minutes and assigning 2 services:
    1) Golf with duration 10 minutes and 2) Tennis with duration 60 minutes.

    The downside of this solution is tennis will also be available to be booked for times like 9:10, 9:20, etc. But you will probably want only 9:00, 10:00, etc.

    Luckily A+ has more than 130+ hooks which can be used for customization and as of V1.2.4.1 there is one for this case too.

    Add these in functions.php of your theme and replace 2 with service ID for tennis.

    function modify_for_tennis( $class_name, $ccs, $cce) {
    global $appointments;
    // Replace 2 with your service ID for tennis
    if ( 2 != $appointments->service )
    return $class_name;
    // Check if $ccs divisible by 3600 which means 1 hour
    if ( $ccs % 3600 == 0 )
    return $class_name;
    return 'app_hide';
    }
    add_filter( 'app_class_name', 'modify_for_tennis', 10, 3 );

    Add this line in "Additional css rules":

    .app_hide{display:none;}

    Note: This will work for monthly calendar only.

    To have more than one appointment per slot, which you may need, please see the FAQ "I want to accept more than one appointment applications for each time slot. Entering higher numbers in "capacity" field in Services tab does not work. Why?"

    You can see the result in the attached screenshots.

    where can I find the appointments+ plugin manual?

    On the "Usage" tab of this page you will see a quick start quide:
    https://premium.wpmudev.org/project/appointments-plus/

    But the real documentation is inside the plugin, in the form of FAQ's, tutorials and setting descriptions. Please refer to Shortcodes tab too for some customization parameters.

    Cheers,
    Hakan

  • doble

    Yeah! Really Thanks Hakan! It works like a charm!
    Some more questions please:

    > I need more services different time based, should i copy and paste the "functions code that you writte" and change the ID?

    > I need to change the "upper limit (days)" depends on the service (so, tennis is 2 days and golf is 1 month) but for tennis, I need to change it by user: so, "members role" can book for 2 days and "friends role" just the same day... how can I do that?

    Really Thanks Hakan!!!!

  • Hakan

    > I need more services different time based, should i copy and paste the "functions code that you writte" and change the ID?

    No, it will not work like that. You should check divisibility for each time base. For example if you have a 30 minutes service, you should check if it is divisible by 1800 (because 60 seconds x 30 = 1800).

    I need to change the "upper limit (days)" depends on the service (so, tennis is 2 days and golf is 1 month) but for tennis, I need to change it by user: so, "members role" can book for 2 days and "friends role" just the same day... how can I do that?

    You can use "app_limit" filter checking the service ID like above:

    function modify_app_limit( $limit ) {
    global $appointments;
    // Replace 2 with your service ID for tennis
    if ( 2 != $appointments->service )
    return 2;
    else
    return 30;
    }
    add_filter( 'app_limit', 'modify_app_limit' );

    Note: I didn't test this.

    You can add additional if clauses and conditions for capability using current_user_can() function:
    http://codex.wordpress.org/Function_Reference/current_user_can

    The rest is php, and simple php :slight_smile:

    Cheers,
    Hakan

  • doble

    Hi Hakan! Really Thanks!

    I need more services different time based, should i copy and paste the "functions code that you writte" and change the ID?

    Sorry, I mean I have 2 services like golf and 8 more like tennis (differents courts) so, how can I add more IDs? Something like:
    // Replace 2 with your service ID for tennis
    if ( 2,3,4,5,6,7,8 != $appointments->service )
    ?

    You can use "app_limit" filter checking the service ID like above:
    function modify_app_limit( $limit ) {
    global $appointments;
    // Replace 2 with your service ID for tennis
    if ( 2 != $appointments->service )
    return 2;
    else
    return 30;
    }
    add_filter( 'app_limit', 'modify_app_limit' );

    it does not work for me... :slight_frown:

    Thanks!!!!!! Really Thanks!!!!!

  • Hakan

    Hi doble,

    Sorry, but this is not valid php at all:

    if ( 2,3,4,5,6,7,8 != $appointments->service )

    You should be already having some php knowledge in order to apply those simple customizations, once we showed you the sample.

    As I noted above:

    As this is not the intended usage, it may have some limitations for you, or you may try to customize as @Vaughan noted.

    We cannot write exact codes for every case, for every member. We are just giving you samples which you should adapt to your case and this requires only basic php knowledge.

    In this case, you should consider hiring a developer, which will probably adapt this in less than 1 hour.

    Cheers,
    Hakan

  • Peter

    Has this feature been added yet?

    I also need different times for different services.

    They are all one to one appointments but I do different types of appointments on different days and also different appointments have different durations.

    For example I do consultations for half an hour and are on specific days of the month. I also do remote support sessions for up to an hour. I then have general meetings which again have a different duration.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.