0.00  View cart

Support Easy Booking: Google Calendar Create 2 events instead of 1 event

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8112
    Christoph
    Participant

    Hi,

    I have a question about your Google Calendar plugin.

    Is there an easy way to create (and update/delete) 2 events instead of 1 event? I extended class-ebc-order-item-event.php, so it was possible to me to create 1 event with the start_date of the booking and 1 event with the end_date of the booking (both only enduring 1 hour)

    Unfortunately, the update process doesn’t work any more as there is only 1 stored event_id per order_item, so I have to extend the meta data also to save 2 event ids.

    But before I do that, did you maybe already do it or tested that?

    The reason why we need this is that the Google Calendar gets very messy with many overlapping bookings. But the only information relevant to us is the start_date and the end_date of the booking as we must plan the pick-up and the return of our rental products. The rest is information we do not need in the calendar.

    Thank you in advance!

    Best regards,

    Christoph

     

     

     

    #8116
    Ashanna
    Plugin's author

    Hello,

    No I’ve never tested it, sorry. I’ve done it like that because each item in cart can have different start/end dates, so I needed to create different events.

    I don’t know if it’s possible with Google Calendar API to check if there is already an event existing for the date without using the event_id…

    Sorry I can’t help more for the moment. It’s an interesting suggestion though.

    Regards,
    Natasha

    #8117
    Christoph
    Participant

    Hi Natasha,

    thanks for your reply. I think you didn’t fully understand my point. It’s perfectly okay to create 1 event for each order item. I even need 2 events for each order item.

    The consolidation of the events is another issue I already solved. We use bundle products, so I only create an event for a bundle product and save the whole order in the description.

     

    Best regards,

    Christoph

    #8118
    Ashanna
    Plugin's author

    Oh right, sorry. I’m still not sure to understand but can you use the existing action hooks (easy_booking_calendar_add_order_item_event, easy_booking_calendar_update_order_item_event) to update the second event right after the first one?

    #8124
    Christoph
    Participant

    Hi,

    it is a little bit more challenging, unfortunately. First, you need a new field in the order item meta for the second id. And many functions explicitely only look at your field, so I had to change that.

    But my main problem is to figure out where exactly you store the event id to the order item meta. If I use your functions, I always get the same id in your field (_ebc_event_id) and my custom field (_ebc_event_id2), so an update/delete of “my second event” is impossible.

    Can you please give me an advice for that? Thank you!

    Best regards,

    Christoph

     

     

    #8125
    Ashanna
    Plugin's author

    Hello,

    So the event ID is created by Google in class-ebc-order-item-event.php line 181 and then added to the order item meta. The function add_order_item_meta (in class-ebc-order.php) is hooked to easy_booking_calendar_add_order_item_event. Does that help?

    #8126
    Christoph
    Participant

    Yes, that helps. Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Want to know what's next with Easy Booking? Check the roadmap!