Question about functionality –

I’m using plugin this to book horseback riding lessons. I’m the riding instructor (human, lol) and I’ve got two horses that are my employees.

I also teach lessons to people with their own horse.

Right now I have my two horses (each by name) set up as service providers with a 3rd choice for ‘Your Own Horse’ as a service provider.

I then have the services set as “half hour riding lesson” and “1 hour riding lesson”.

My question is, is there a way to set the plugin so MY two horses do not get back to back bookings, but I can still get back to back bookings?

The reason, it is unfair to ask them to give a 1 hour lesson and turn right around and do it again, they typically need a 3 hour rest time.

But it is not unfair to ask me (the human) to keep working. I don’t get a rest time. :slight_smile:

At first I had the lesson blocks tripled in time, but that kept ME (the human) from getting more bookings from students with their own horses.

I’ve been playing with the plugin for about 4 hours, so I figured I’d ask.

  • aecnu
    • WP Unicorn

    Greetings RAWD,

    Welcome to WPMU DEV!

    Thank you for the great question and though I dug into this I could not see how to possibly set a break after a scheduled appointment for each service provider.

    Therefore I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Hakan
    • The Incredible Smush

    Hi,

    The duration of the lessons that your horses “give” are actually 1+3=4 hours. So define 2 services:

    1) For yourself which lasts 1 hour. Assign yourself (Our client’s horse) here.

    2) for your horses which lasts 4 hours. Assign your horses to this service.

    Now they cannot be booked more frequent than 4 hour intervals, but you can be.

    Just to correct the duration display on the confirmation form, add these codes to functions.php of your current theme:

    function modify_duration_text( $text, $duration ) {
    return '60 minutes';
    }
    add_filter('app_confirmation_lasts', 'modify_duration_text', 10, 2);

    Now for all services, duration will be displayed as 60 minutes.

    Cheers,

    Hakan

  • aecnu
    • WP Unicorn

    Greetings RAWD,

    We have not heard back from you as to the status of this issue.

    If you are still having an issue please let us know so that we may try to get you fixed up as soon as possible by choosing to check mark this ticket as unresolved below and posting any new errors or symptoms you are noticing.

    This action will also bring your ticket up front back in plain view again within the ticket system.

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • RAWD
    • WPMU DEV Initiate

    I’m sorry, it took me a few days to get back to this. Thank you so much for the reply / effort. :slight_smile:

    I’m afraid I may not understand so I’ll explain what I’ve done step by step. Keep in mind I have to be at every appointment, because I teach each lesson. The two horses “Madison” and “Penny” would need a reset time after each appointment to rest. Client owned horses do not need that reset.

    1. I set up a service called “One Hour – Your Horse” which lasts 1 hour

    2. Set up a service for horse “Madison” called “One Hour – Madison” which lasts 4 hours

    3. Set up a service for horse “Penny” called “Kid Lesson – Penny” which lasts 4 hours

    4. Then I went in to USERS and created “Penny” and “Madison”

    5. Then I went into SERVICE PROVIDERS and…

    6. Created a provider called “Madison” and assigned her to the service “One Hour – Madison”

    7. Created a provider called “Penny” and assigned her to the service “Kid Lesson – Penny”

    8. Assigned myself, KayeBarnes, to “One Hour – Your Horse”

    When I have that all in place and go to the calendar I can select an appointment on Tuesday at 10:30 for Madison, and make the appointment. I go into the admin and accept/confirm the appointment.

    Then I go back to the calendar to set a lesson for Penny (service & provider) and that Tuesday at 10:30 time slot is open (for Penny). However I’m already giving a lesson at 10:30 (with Madison) so even if Penny (horse) is available, I’m not.

    Am I misunderstanding a step?

  • Hakan
    • The Incredible Smush

    Hi,

    I thought that you may hire your horses without being yourself there.

    I now see that you yourself must be there in case Penny or Madison booked.

    It means everybody should be booked for at least one hour in any kind of appointment, because your horses cannot be booked without you. In other words when you are booked your horses should be booked for one hour and if one of your horses booked you and your other horse should also be booked for one hour.

    So in some cases you will need 2 providers (your horse + yourself) and some providers’ availability depends on another one (namely you).

    Am I correct until here?

    Normally A+ does not support such cross checks and does not support 2 providers for one appointment. But luckily you can do this by adding fake appointments.

    This will do the trick by automatically adding 2 fake appointments for your other 2 providers:

    function book_others_too( $app_id ) {
    global $appointments, $wpdb;
    $a=$appointments;
    $app=$a->get_app( $app_id );

    foreach ( $a->get_workers() as $worker ) {
    if ( $worker->ID == $app->worker )
    continue;
    $wpdb->insert( $a->app_table,
    array(
    'created' => $app->created,
    'service' => $app->service,
    'worker' => $worker->ID,
    'status' => $app->status,
    'start' => $app->start,
    'end' => date ("Y-m-d H:i:s", strtotime($app->start) + 3600 ),
    'note' => 'This is an automatic appointment'
    )
    );
    }
    }
    add_action( 'app_new_appointment', 'book_others_too' );

    Tested and working.

    Note: These “fake” appointments will follow the same status that of the original one at the time of applying for the appointment. So you should confirm them manually as well, if you don’t use auto confirm.

    If you need further customizations, you should consider hiring a developer. He can extend this functionality based on the above sample.

    Cheers,

    Hakan

  • RAWD
    • WPMU DEV Initiate

    I thought that you may hire your horses without being yourself there.

    If only horses could teach riding lessons by themselves. LOL, then I’d be making some money.

    Anyhow… this seems to be working correctly on the front end, based on the settings I created in my numbered list on my (I believe) second post in this thread.

    To start with I cleared out any appointments that were in there as tests (pending, reserved by GCal, and Removed).

    From the front end, if I select “One Hour Madison” with service provider “Madison”, and set an appointment for 10:30 am, it will indeed block off the calendar from 10:30 – 2:30 pm, which is what is expected. Great. :slight_smile:

    On the back end I’m a bit confused. When I go in to view Pending Appointments, there are 3 unique entries that look like this:

    ID 24 DATE/TIME April 8, 2013 10:30 am SERVICE “One Hour Madison” PROVIDER “Penny”

    ID 23 DATE/TIME April 8, 2013 10:30 am SERVICE “One Hour Madison” PROVIDER “KayeBarnes”

    ID 24 DATE/TIME April 8, 2013 10:30 am SERVICE “One Hour Madison” PROVIDER “Madison”

    Is this correct? Do I approve the obvious one (the one where the service’s name matches the service provider) and delete the other two, or do they ALL need to be approved in order for the front end to function properly? (I’m just asking… I’m off to go test it now).

    Just in case, I did double checked to make sure I had the right service providers associated with the correct services (one service provider with one service).

    Thank you again.

  • Hakan
    • The Incredible Smush

    Is this correct? Do I approve the obvious one (the one where the service’s name matches the service provider) and delete the other two, or do they ALL need to be approved in order for the front end to function properly?

    Yes, what you see is correct. The first one (provider:Madison) is the original appointment. The others (KayeBarnes and Penny) are fake appointments to block your working hours, because neither you nor Penny can be available for one hour from Madison’s appointment (But Madison will not be available for 4 hours). In notes, you will see the explanation “This is an automatic appointment”. Change it as you wish.

    You should not delete those appointments and 3 of them should be approved at the same time. You can use Bulk status change functionality for this.

    Cheers,

    Hakan

  • aecnu
    • WP Unicorn

    Greetings RAWD,

    Considering the lead developers last post, it appears this particular topic is now resolved/closed, if you need any further assistance please let us know.

    If it wasn’t resolved, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the ‘Mark as Not Resolved (re-open)’ box below the post area (or else we’ll miss it!)

    Thank you for being a WPMU Dev Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.