Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Required Field + Multi Booking
- This topic has 8 replies, 2 voices, and was last updated 3 years, 4 months ago by Andre Flores.
- AuthorPosts
- June 8, 2018 at 2:11 pm #686727Christine RosParticipant
Hi again,
– Hotel plugin used in Pet Hotel –
I have translate Guest Field in Name+breed+sex of animal. I need this field required. Is it possible ?
Also in settings, I have primary checked “skip search results and allow direct booking from accommodation”. During test I can only book the selected accommodation type – exemple Kennel – It seems there is no way to add another accommodation in the same booking if the client own several species.
Maybe it should be a good feature to add something like “add another accommodation or make another booking” the client can choose
Or did I missed a setting ? I am thinking about purchase Woocommerce plugin, should it solve the problem ?
June 11, 2018 at 2:44 pm #687513J. DavisKeymasterHi Christine,
Skip search results page was added for single properties where multiple bookings are not needed. If you need to make multiple bookings for one session you should disable skip search results page.
As for Full Guest field so there is no option to make it required. However you can do this by overriding its function. For example you can place the code below ot functions.php file of your Child Theme:
add_action( 'wp_head', 'remove_renderGuestsChooser' ); function remove_renderGuestsChooser(){ remove_action( 'mphb_sc_checkout_room_details', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderGuestsChooser' ), 20, 3 ); } add_action( 'mphb_sc_checkout_room_details', 'custom_renderGuestsChooser' , 20, 3 ); function custom_renderGuestsChooser( $roomType, $roomKey, $booking ){ $namePrefix = 'mphb_room_details[' . esc_attr( $roomKey ) . ']'; $idPrefix = 'mphb_room_details-' . esc_attr( $roomKey ); $maxAdults = $roomType->getAdultsCapacity(); $maxChildren = $roomType->getChildrenCapacity(); // -1 -> nothing selected ("— Select —" active) (cannot use 0, value 0 // exists in the children's option list) $presetGuests = array( 'adults' => -1, 'children' => -1 ); $reservedRooms = $booking->getReservedRooms(); // Setup preset guest allocation for single room booking if ( count( $reservedRooms ) == 1 ) { if ( MPHB()->settings()->main()->isDirectBooking() ) { $presetGuests['adults'] = MPHB()->settings()->main()->getMinAdults(); $presetGuests['children'] = MPHB()->settings()->main()->getMinChildren(); } else { $reservedRoom = reset( $reservedRooms ); $presetGuests['adults'] = $reservedRoom->getAdults(); $presetGuests['children'] = $reservedRoom->getChildren(); } } ?> <p class="mphb-adults-chooser"> <label for="<?php echo $idPrefix . '-adults'; ?>"> <?php _e( 'Adults', 'motopress-hotel-booking' ); ?> <abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr> </label> <select name="<?php echo $namePrefix . '[adults]'; ?>" id="<?php echo $idPrefix . '-adults'; ?>" class="mphb_sc_checkout-guests-chooser" required="required"> <option value=""><?php _e( '— Select —', 'motopress-hotel-booking' ); ?></option> <?php for ( $i = 1; $i <= $maxAdults; $i++ ) { ?> <option value="<?php echo $i; ?>" <?php selected( $i, $presetGuests['adults'] ); ?>> <?php echo $i; ?> </option> <?php } ?> </select> <?php if ( $roomType->getChildrenCapacity() > 0 ) { ?> <p class="mphb-children-chooser"> <label for="<?php echo $idPrefix . '-children'; ?>"> <?php printf( __( 'Children %s', 'motopress-hotel-booking' ), MPHB()->settings()->main()->getChildrenAgeText() ); ?> <abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr> </label> <select name="<?php echo $namePrefix . '[children]' ?>" id="<?php echo $idPrefix . '-children'; ?>" class="mphb_sc_checkout-guests-chooser" required="required"> <option value=""><?php _e( '— Select —', 'motopress-hotel-booking' ); ?></option> <?php for ( $i = 0; $i <= $maxChildren; $i++ ) { ?> <option value="<?php echo $i; ?>" <?php selected( $i, $presetGuests['children'] ); ?>> <?php echo $i; ?> </option> <?php } ?> </select> <?php } ?> <p class="mphb-guest-name-wrapper"> <label for="<?php echo $idPrefix . '-guest-name'; ?>"> <?php _e( 'Full Guest Name', 'motopress-hotel-booking' ); ?> <abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr> </label> <input type="text" name="<?php echo $namePrefix . '[guest_name]'; ?>" id="<?php echo $idPrefix . '-guest-name'; ?>" required="required" /> <?php }
Best regards,
JohnJune 16, 2018 at 7:25 am #689340Christine RosParticipantWorks fine. Thank you
June 16, 2018 at 8:41 am #689341Christine RosParticipantIn fact, not work fine, fields are duplicated:
instead of 1 field Adult and 1 field Guest, the code render1 adult field
1 guest field1 adult field
1 guest fieldHow to fix it ?
Thanks
June 17, 2018 at 6:11 pm #689623Christine RosParticipantEdit of previous post :
– the first adult field is “*”
– the first guest field is “*”
– the second adult field is “*”
– the second guest field isn’t requiered
ThanksJune 18, 2018 at 2:27 pm #689956J. DavisKeymasterHi Christine,
Thank you for your reply. I’ve updated code at reply #687513 that should work properly now. Please try to place it instead.
best regards,
JohnJune 18, 2018 at 3:55 pm #689979Christine RosParticipantHello Mr Davis,
The problem is solved.
Thank you.Have a good day.
ChristineJuly 5, 2021 at 5:57 am #1152043CarlanaParticipantHi, I need to make the notes field mandatory on the checkout is there any way to do this?
July 8, 2021 at 1:23 am #1153670Andre FloresModeratorHello Carlana,
Kindly perform changes provided in this topic in order to make the “Notes” field required.
Regards,
Andre - AuthorPosts
- You must be logged in to reply to this topic.