Required Field + Multi Booking

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #686727
    Christine Ros
    Participant

    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 ?

    #687513
    J. Davis
    Keymaster

    Hi 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,
    John

    #689340
    Christine Ros
    Participant

    Works fine. Thank you

    #689341
    Christine Ros
    Participant

    In fact, not work fine, fields are duplicated:
    instead of 1 field Adult and 1 field Guest, the code render

    1 adult field
    1 guest field

    1 adult field
    1 guest field

    How to fix it ?

    Thanks

    #689623
    Christine Ros
    Participant

    Edit 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
    Thanks

    #689956
    J. Davis
    Keymaster

    Hi 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,
    John

    #689979
    Christine Ros
    Participant

    Hello Mr Davis,

    The problem is solved.
    Thank you.

    Have a good day.
    Christine

    #1152043
    Carlana
    Participant

    Hi, I need to make the notes field mandatory on the checkout is there any way to do this?

    #1153670
    Andre Flores
    Moderator

    Hello Carlana,

    Kindly perform changes provided in this topic in order to make the “Notes” field required.

    Regards,
    Andre

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