[mphb_checkout] number of guests for services

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #1198177
    Felizia Katzer
    Participant

    Hello,

    I have services that can choosen for the number of guests.
    When the guest ueses the checkout form, per default, the number of guests for this services are the maximum of guests that are allowed for the accomodation.
    Independent which number of guests he selected at the checkout.
    So for example he choose 2 guests and checkt a towel package for 4 persons. And forget to change the number.

    Is there a way to initialise the number of guests in dependence to the number of guests that where choosen in the form?

    Thank you
    Felizia

    #1199648
    Andre Flores
    Moderator

    Hello Felizia,

    This is how the Hotel Booking plugin functions by default at the moment. We do have a feature request change the default number of guests the service is applied to and I have added your up-vote to it as well. In case there are more similar requests, we will consider implementing this option in one of the plugin future updates.

    Regards,
    Andre

    #1199899
    Felizia Katzer
    Participant

    great thank you

    #1200221
    Andre Flores
    Moderator

    You are welcome!

    #1208087
    Domaine Langelet
    Participant

    We would also benefit from this improvement.

    #1208172
    Felizia Katzer
    Participant

    perfect Theo. Hope the development will take place soon.

    #1387984
    Felizia Katzer
    Participant

    Someone else who hast the problem with the services and the number of guests that displayed per default?

    #1388057
    Mickael Quirin
    Participant

    for what its worth, if thats what you need,

    View post on imgur.com

    you can test this:

    (function ($) {
    	$(document).ready(function() {  
            
            $('.mphb_checkout-guests-chooser').change(function(){
                let booking_number = $(this).attr('id').split('-')[1];  
                let selector = '[id^=mphb_room_details-' + booking_number + '-service]';
                $(selector).val($(this).find("option:selected").attr('value')).trigger("change");
            });
         });
    })(jQuery);
    

    to add it, you can install wpcode plugin ,
    add a new snippet,
    choose custom snippet and paste the code inside,
    choose javascript snippet on the right.
    leave auto-insert and site-wide header .
    click on activate and save on the top right

    it should work for multiple reservation (its not activated here so I can’t test it).

    #1388291
    Felizia Katzer
    Participant

    Hello Mickael,
    thank you for your solution.

    I entered it in the functions.php and receive this error message:
    syntax error, unexpected ‘$’, expecting variable (T_VARIABLE)

    Did I something wrong?

    Thank you
    Felizia

    #1388293
    Felizia Katzer
    Participant

    Now I tried it with the plugin and installed it and entered the code.
    Now it works, great solution, this helps me very much, thank you
    Greetings Felizia

    #1388314
    Mickael Quirin
    Participant

    If you want to add it to your function.php file, you need to remove the first and last line and put it before the })(jQuery); line, but you have the risk that your modification will be erased with an update.

    Glad it help you out

    #1394329
    Felizia Katzer
    Participant

    Hello Mickael,
    when I user your code snippet, the calculation of services did not work any more. e.g. service for a dog is not displayed in the prices when it was selectes as a service. Do you have an idea?
    Thank you
    Felizia

    #1394344
    Mickael Quirin
    Participant

    What do you mean by not displayed in the price ?
    The price breakdown does not update when the number change ?

    #1394427
    Felizia Katzer
    Participant

    in the price breakdown the services were not displayed when they are selected. How can I send you a picture for this scenario?

    #1394436
    Mickael Quirin
    Participant

    Don’t worry, it’s the same for me, I’ll look into it and come back here when I find out why with a code update.

    Sorry for that

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.