How do I add "padding" to time slots?

Hi, Des_Walsh had a similar question, but I need code to reflect my situation.
I want people to be able to book in 30 minute intervals, eg. 9.30, 10, 10.30,11 etc, for sessions that last 90 min. PLUS have 30 minutes padding to prepare for next session. How would I modify the code below that Hakan recommended?
See: function modify_duration_text( $text, $duration ) {
return '30 minutes';
}
add_filter('app_confirmation_lasts', 'modify_duration_text', 10, 2);
Because I dont want the customer to see 120 min in their receipt, I cant just set the duration to 120.
AND I want people to still have time slots available every 30 minutes. If I set it to 90 minutes, eg 9am, 10.30am, 12pm I miss out if someone wants to start at 9.30 as that is not possible.
Hope you can help, thanks Hart

  • Groggo

    Hi thanks for the fast reply! My client offers childrens parties. Each Party lasts 90 minutes. then they need 30 minutes for prep. If they configure the duration to 120 minutes the receipt says: You are booked for 120 minutes. So in order to only show the 90 minutes on the receipt I thought it's best to set the time to 30 minutes, then add custom code to the functions.php that alots 4 x 30 minutes if someone books... and shows 90 minutes on the receipt, AND shows the calender slots blocked for 120 minutes.
    My problem was that if I set durations to 90 min and code for 30 min padding then the calender only shows available slots at 120 minute intervals.. eg. 9am / 11am / 1pm etc..
    Hope you follow me so far. I want people to be able to see times available like" 9am, 9.30 am, 10am etc it does not mean that the full 90 min is available but they can choose the starting time better, eg maybe they want to start at 9.30 am. Hope you understand, thanks, Hart

  • Jack Kitterhing

    Hi there @Hart

    Thanks for the additional information, much appreciated, I don't think setting it at 4 slots for 30 minutes would work here really.

    If you set the time to 120 minutes and then used

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

    Would that work? :slight_smile:

    How does it work front-end for the person booking the party, does your client just show a calendar of when they are available and then the user books the party?

    Thank you!

    Kind Regards
    Jack.

  • Groggo

    Hi there, yes, here is the client scenario: They run a playground business where people can walk in and let their child play.. PLUS, offer private party rooms for 90 min a time slot, and that's where the calendar booking system is used online: So when a website visitor finds the party page, they can check out the calendar for available time slots. Some slots might already be occupied by previous bookings and some are still open.
    So for example if someone sees there is a opening at 11.30 am they could book that online and the calendar would then block 11.30am - 1.30pm because the operator needs half hour prep time for next visitor.
    Now the problem is there are no Fixed Sessions as such, just the whole day to pick your start time. Imagine you want to organise a party for yourself and choose 7pm. Then the calendar would block 7pm-9pm. However there is another problem.
    What if someone comes in and tries to book a party at 6.30pm ? Will that slot also be blacked out because they can't have a session long enough to fir in before 7pm.
    I know this is a bit complicated, but if we can get the right customisation then this would be great.
    Hope that helps

  • pxwm

    Hi @Jack Kitterhing

    Out of interest the code you suggested in your earlier post used to work in v1.2.8.

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

    and also the following code used to work

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

    You would set the Time base to 30mins and the Service duration to 120mins and then the code would show 90mins in the frontend tot he user.

    Is @Vladislav saying this no longer works in v1.3 or even if v1.3.1-BETA-3 is installed and added the following code to wp-config.php to switch back to v1.2.8 time base rules?

    define('APP_USE_LEGACY_DURATION_CALCULUS', true);

    Regards
    SteveB

  • Groggo

    Hi Steve, I used the code:
    function modify_duration_text( $text, $duration ) {
    return '90 minutes';
    }
    add_filter('app_confirmation_lasts', 'modify_duration_text', 10, 2);

    in version 1.3 NOT Beta.
    It works to a degree. The calendar shows 2 hour blocks but when someone books it shows the 90 minutes in the "confirmation details: booking duration = 90 mins" so that is not perfect but is ok at the moment for my client...

  • pxwm

    Hi @Groggo

    That's partly good news.

    Could you please confirm if this is all okay except that you would want the schedule to show 30min time slots?

    If so you may wish to try uploading the 1.3.1-BETA-3 version and then add the code to the wp-config.php file I included in my previous post. This will then revert the time base rules to v1.2.8 and it should show 30min time slots in the schedule as long as you have set the time base in the A+ Settings 'General' tab to 30mins.

    However if you decide to upload I suggest you take a backup of your website and database so at least you can rollback to v1.3

    Just out of interest you stated:-

    The calendar shows 2 hour blocks but when someone books it shows the 90 minutes in the "confirmation details: booking duration = 90 mins" so that is not perfect but is ok at the moment for my client...

    Could you please confirm if it shows this in the appointment form before you click the confirmation button?

    I ask because mine show 120mins.

    Regards
    SteveB

  • Groggo

    Hi Steve, thanks for your help. My confirmation looks like this:
    Date and time: October 1, 2013 10:00 am
    Lasts (approx): 90 minutes
    Now, I don't want to roll back, this has to do for now, it's not perfect but I realize what we need is a custom code.
    To get what we really need, only a custom code can do that. Situation re-cap:
    We have 3 available "party rooms"
    (In a complex with other businesses)
    The operating hours are 10am-9pm weekdays and Saturday and 11am-6pm Sundays.
    Each Party lasts 90 min.
    We need 30 min prep time after each session.
    So if you consider that one party could start at 9 and go to 10.30, next 11-11.30 etc
    AND at the same time some other party could start at 9.30 or even 10, and another at 10.30, each of course in the other rooms...
    (BUT I did not want to have 3 services as this is a bit hard to describe different start times.. and have it all in 1 click calendar.. , but it might be one solution to consider.)
    Am I asking for too much, maybe? I am not a coder and of course it's hard to imagine what is possible and what is not.
    So if you or anyone else can offer a working calendar that can accommodate 3 time slots like above let me know and I can ask my client if they want to pay the extra custom code fee, and if, how much would that cost?
    It's been an interesting experience to check pout Appointment+, thanks to everyone involved!

  • pxwm

    Hi @Groggo

    What you describe should be possible but would appreciate if you could provide/confirm the following:-

    Do you have a url of your current appointment page so I can check how it is currently working for one Service.

    Does the schedule show 2hour blocks?

    Could you please confirm if the 90mins is shown in the appointment form before you click the confirmation button?

    If you wanted 3 x services for different rooms would there be 3 x Service Providers? ie. 1 x Service provider for each party room?

    Regards
    SteveB

  • Groggo

    Hi Steve, thanks for your great work!
    I have created a calendar on a restaurant test site since I want to do more of those in the future.
    The situation is easier to imaging: You have 3 areas in your restaurant that can be booked for private parties. You don't need extra staff, no "providers" needed. One waitress can serve the 3 areas...
    You can hire out the party area within the working hours of the restaurant.
    In this case it's set from 10am-9pm
    Parties last 90 min.
    Now you can see if someone want to book a "Morning Tea Party" at 10.30 I am already in trouble because of the "time slots"
    Maybe you have some ideas?
    http://www.artandcraftconnection.com/restaurant/bookings/
    When I click on a time slot booking the next window shows 90 min:
    "......Lasts (approx): 90 minutes" (not sure why your page shows 120 min.. it shows 2-4, 4-6 etc in the calendar which is of course 120 min but I was told this could not be configured differently)
    Hope this helps, would be cool if something better comes out of this..
    Cheers, Groggo

  • pxwm

    Hi @Groggo

    I found the problem why my schedule on my demo site was showing 120mins and not 90mins and it was the theme.

    I've read your requirements and checked out your demo website and if you are okay I'll set my demo site up to match your requirements and then once I have it working I'll let you check it out to see if it meets your requirements and then I can provide you with the settings.

    Just one question.
    You state:-

    You don't need extra staff, no "providers" needed. One waitress can serve the 3 areas...

    Could you confirm if it would be okay to use 'no specific provider' as I'm hoping I can 'force' it to accept appointments for all three services on the same date and time without the user having to select a Service Provider.

    Regards
    SteveB

  • pxwm

    Hi @Groggo

    For information, setting the capacity to 3 for the Service doesn't allow 3 appointment to be made for the same date and time unless you have 3 Service Providers created and assigned to the service.

    I've created a demo site using your setting and I'm using v1.3.1-BETA-3 with the time base rules to allow 30min slots to be visible and 90mins showing in the booking form

    Please check out the demo site at: http://appoint.pxwm.co.uk/

    The styling of the site is very basic but hopefully it will allow you to make appointments for the three services.

    If you click on 'PRIVATE PARTY BOOKINGS' link it will display the page and automatically select the 1st service and show the schedule for that service.
    If you click on a date and time it will display the booking form.
    To keep things simple I've only enabled the email field so when you click the button to confirm the appointment you will receive a confirmation email just to have an idea what can be included in the confirmation email.

    Please try it out and make some appointments to confirm if this meets your requirements.

    Regards
    SteveB

  • Groggo

    Thanks Steve, your calendar works well. For me this one is a bit large, as many people now also use mobiie devices, we want to keep it more compact to fit small screens too. So at the moment what we got so far is satisfactory. (It works ok for a cheap plugin.) Maybe future upgrades will include more functionality.
    Thanks for everyone's input! Awesome support here! Will recommend this to anyone that asks me about a booking calendar!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.