Support » Plugin: Table Reservation » Default reservation duration in Pro version.

  • Resolved kisukecze

    (@kisukecze)


    Hi,

    is there a way to change default “reservation duration” when I enable “Custom reservation duration” in Pro version?
    Now I set minimum reservation time to 1 hour, maximum reservation time to 5 hours. And “Average reservation duration” is set to 1 hour. But when customer makes a reservation, slider to select duration defaults to 3 hours. Any way to change this? (even if it’s in db or file).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ivan Zambouka

    (@vanadiuz)

    Hi,

    1) you can change default “reservation duration” text either using your own translation for this field or modify the necessary line in the file table-reservation.php(but then everything will break upon the next update).

    2) “Average reservation duration” was implemented so that the plugin could calculate when (approximately) one or another table would be free if users could not select the exact time how long they would stay (e.g. “Custom reservation duration” is disabled).
    Unfortunately, to change this behavior, it is not enough to correct one line in the .php file.

    But thank you for your message, in the future I will add to this switch the logic you mentioned.

    Best
    Vania

    Thread Starter kisukecze

    (@kisukecze)

    Hi, thanks for quick response.

    I did not meant changing text. But the value of reservation duration, which is preselected by default, when customer wants to make reservation.
    Now it seems it is set by default to exactly middle value between minimum and maximum length. If I could change it somewhere, I would like to (but it is not absolutely necessary). Because typical reservation for our type of bussiness is 1 hour. But I want to give clients option to reserve their favourite table for whole opening hours if they want to.

    I am of course aware that any changes in plugin itself (js or php files) will be overwritten by every update.

    Anyway, I will be happy if there will be option to change it in GUI in future versions. “Average reservation duration” could be good place where to set this, if custom duration is enabled. It makes sense to me.

    Thread Starter kisukecze

    (@kisukecze)

    Hi,

    just for info, I managed to achieve this behavior by this modification:

    In files: assets/js/app.12ce87c98b58bdcd80f2.js and assets/js/app.fe4dc0b7912549703fc7.js

    Find this string:
    this.sliderValue = Math.floor((this.sliderMin + this.sliderMax) / 2) - Math.floor((this.sliderMin + this.sliderMax) / 2) % this.sliderTimeInterval

    And replace it with this string:
    this.sliderValue = Number(this.calendarTimeInitData.reservation_duration)

    Works perfect after that.
    (Actually I cannot say what original code was counting. If someone could explain, it could be interesting. But it did not make any sense to me – probably I will have to draw it to understand that…)

    Plugin Contributor Ivan Zambouka

    (@vanadiuz)

    Dear Kisukecze,

    thank you, that you solve this problem.
    My code takes an average between min and max possible durations (Math.floor((this.sliderMin + this.sliderMax) / 2)). Imagine that min is 45 min and max is 300min. Than avg. is 172. But timestep of the slider is 15min (for example). What means that if you will set the slider to 172, it could raise an error. Wou need to do remove this: Math.floor((this.sliderMin + this.sliderMax) / 2) % this.sliderTimeInterval what is 7 in our case. And set slider to 172-7 = 165 what is devidible by 15!

    Best
    Vania

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Default reservation duration in Pro version.’ is closed to new replies.