• Resolved sstixx

    (@sstixx)


    Hi,

    I’m using the reservation plugin in combination with qtranslate x.
    Both are working fine, but i was wondering if it would be possible to find out what language they used to fill in the form.
    This so we can response in the proper language. I know we could write the reply in multiple languages. But as the site is for a small business it would be nice to be able to use a personal approach.
    Therefore my question if this can be determined in some way.

    Kind regards,

    SstixX

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @sstixx,

    There’s no way to accomplish this without custom coding. If that’s something you’re comfortable with, and you’re familiar with the hooks system of actions and filters in WordPress, you can hook in to save additional data with the booking.

    You’d hook into rtb_insert_booking to save metadata with the current language to a booking when it’s created:

    https://github.com/NateWr/restaurant-reservations/blob/master/includes/Booking.class.php#L171

    You’d then need to hook in before a notification is sent using the rtb_send_notification_before action.

    https://github.com/NateWr/restaurant-reservations/blob/master/includes/Notifications.class.php#L174

    There you’ll have to get the booking from the notification object, load the translate data that you saved, and adjust the notification as you’d like.

    Thread Starter sstixx

    (@sstixx)

    Hi NateWr,

    Thank you for the pointers so far. I’m just getting started with all of this.
    So let’s say i know bit and pieces when it comes to hooks, but don’t feel that comfortable yet with it.
    So far i managed to figure out from qtranslate side that the language can be retrieved by using “qtranxf_getLanguage()”.
    Not sure if that changes things are would make things easier.
    Would you be able to point me in the right direction. I would already be happy if this can just be indicated in the email that would be send in case booking would be made.

    Kind regards,

    SstixX

    Hi @sstixx,

    You’ll need to save the language with the booking, because qTranslate’s function will only retrieve the language that’s currently being used. When you confirm or reject a booking, and that notification email is sent, it will retrieve the language you’re using in the admin area. So you need to save the language that’s being used when the booking is created, and use that.

    I’m afraid I can’t be much more help. You’ll need to be familiar with saving post metadata and using the hooks system. You can see lots of example code snippets in the developer documentation here:

    https://doc.themeofthecrop.com/plugins/restaurant-reservations/developer/

    Otherwise, I would recommend you consider reaching out to codeable.io. They match customization projects like this with qualified freelancers at reasonable rates. If you have a bit of a budget to implement this feature, someone comfortable with qTranslate and the hooks system should be able to do it fairly easily.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘identify reservation origin’ is closed to new replies.