Okay
  Public Ticket #2203422
Multiple bookings at one time
Closed

Comments

  • Tom Stotesbury started the conversation

    Hello, I have been looking into your plugin and it looks great. But I can't see if it is possible for my clients to book more than one appointment at the same time, with one payment.

    I look forward to hearing from you.

    Thanks, Tom

  •  1,818
    Miloš replied

    HI Tom,
    Thank you for your inquire.

    Sorry to disappoint you but unfortunately multiple booking is not possible at the moment. 

    We do have in plant to implement this feature for some future updates of the plugin.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Tom Stotesbury replied

    Hi Bogdan, thank you for your reply. That is a shame because it looks like such a great plugin. Unfortunately that feature is essential for me. Do you have any idea when you might implement this update?

  •  1,818
    Miloš replied

    HI Tom,

    I can not tell you precisely the date when this will be implemented because we are working on features that are most requested from our customers.

    When we implement those features multiple bookings will be for sure our top priority for the update.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Kostas replied

    Hello everyone,

    Tom, I needed the same functionality and have manually implemented this. I am however using woocomerce for the checkout. If you are willing to use woocomerce for the checkout I can implement it for you.

    Here is a demo: https://soflo.ttic.ca/booking/

    Note: on this demo site no emails are ever sent.

    You can reach me at [email protected]

  • Kostas replied

    Also, I would be happy to share my code with Amelia, thought I am not sure it would be too much help to the team.

    What I have done is fairly simple.


  •  1,818
    Miloš replied

    Hi Kostas,

    Thank you for your feedback, if you have any suggestion or workaround feel free to share it on this ticket. This ticket is public so other customers can see the workaround until we found a proper solution.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Kostas replied

    Hi Bogdan, 

    Thanks for your feedback.

    My chages are very simple and are only directly applicable to simple and specific use cases. That is, I know that implementing this change properly to account for - and be compatible with - all the features of Amelia requires a lot more work than what I have done.

    But I'll share this - limited - workaround for whatever it's worth:


    First off this only applies when using woocommerce as a payment gateway. Also, these are unfortunately core edits (there is no other way, relavant hooks are not provided), so you will have to do this each time you update Amelia.

    The first thing to do is comment out (or remove) the following code in the addToCart() function in file

    `/src/Infrastructure/WP/Integrations/WooCommerce/WooCommerceService.php`
    foreach ($wooCommerceCart->get_cart() as $wc_key => $wc_item) {    
        if (isset($wc_item[self::AMELIA])) {        
            $wooCommerceCart->remove_cart_item($wc_key);    
        }
    }

    This will allow Amelia to add multiple items to cart, instead of overwritting the previous addition with each new booking.


    After this you will come upon the following problem:
    - Say you make a booking for say tomorrow at 9am and add it to your cart.
    - Then you go back to the booking form and want to add another booking for the same day: You will see the 9am time slot being available (although you added it to the cart before). 

    So you would probably want this 9am time slot to NOT be available on your 2nd (or subsequent) booking attempt(s).

    The workaround here involves hacking Amelia to take into consideration the timeslots that are in the woocomerce cart already, and as such, removing these timeslots from each user's rendering of the booking form calendar.

    If you only have say 1 service, or if all you services have the exact same time slots (and duration) then this it's pretty straightforward: in the handle() function on line 70 (right after the $freeSlots variable has been defined) in the file:

    `/src/Application/Commands/Booking/Appointment/GetTimeSlotsCommandHandler.php`

    just add (no need to add the commented out lines here -> '//' )

            $cart = WC()->cart->get_cart();
            foreach ($cart as $item) {
                $bookingService = $item['ameliabooking']['serviceId'];
                $bookingStart = $item['ameliabooking']['bookingStart'];
                $bookingStartDate = substr($bookingStart, 0, 10);
                $bookingStartTime = substr($bookingStart, 11, 5);
                unset($freeSlots[$bookingStartDate][$bookingStartTime]);
                
                // logic for further unsets depending on your services and setup
                // if($bookingService === 2) {
                //    your logic for dealing with booking service 2 etc
                //}
            }

    Now if your services have different time slots and/or duration (and possibly time before/after booking settings) you will need to add more code to determine which time slots to remove from the available slots.

    So this is just a very basic starting point.

  •  1,818
    Miloš replied

    HI Kostas,

    Thank you for your feedback, I will forward your suggestion and workaround to my team so we can hopefully find some solution for the future updates.

    Thank you again.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables