Check-in range Hours

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #763481
    fabrizio anichini
    Participant

    Hi, Int the checkout page the check-in is formated in this way:
    Check-in: January 25, 2019, from 11:00 am

    I want to change for show the details in this way:
    Check-in: January 25, 2019,from 15:00 am to 19:30 am

    Is there any way to do this?

    #765617
    J. Davis
    Keymaster

    Hello Fabrizio,

    As there is no option to indicate the time-frame for Check-In you may add this information as text to Booking Confirmation page before [mphb_checkout] shortcode.

    or override initial function hardcording with your custom text e.g.:

    add_action( 'wp_head', 'remove_my_class_action' );
    function remove_my_class_action(){
    	remove_action( 'mphb_sc_checkout_form_booking_details', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderCheckInDate' ) );
    }
    
    add_action( 'mphb_sc_checkout_form_booking_details', 'renderCheckInDate' );
    function renderCheckInDate( $booking ){
    		?>
    		<p class="mphb-check-in-date">
    			<span><?php _e( 'Check-in:', 'motopress-hotel-booking' ); ?></span>
    			<time datetime="<?php echo $booking->getCheckInDate()->format( 'Y-m-d' ); ?>">
    				<strong>
    					<?php echo \MPHB\Utils\DateUtils::formatDateWPFront( $booking->getCheckInDate() ); ?>
    				</strong>
    			</time>,
    			<span>
    				<?php _ex( 'from', 'from 10:00 am', 'motopress-hotel-booking' ); ?>
    			</span>
    			<time datetime="<?php echo MPHB()->settings()->dateTime()->getCheckInTime(); ?>">
    				<?php echo MPHB()->settings()->dateTime()->getCheckInTimeWPFormatted() . ' to 19:30'; ?>
    			</time>
    		</p>
    		<?php
    	}

    You may adjust time format at WordPress settings.

    best regards,
    J. Davis

    #978695
    Michal Popelka
    Participant

    Hi, where to insert this code? In function.php?

    #979081
    Andre Flores
    Moderator

    Hello, Michal!

    If you would like to overwrite the function itself, then yes, the code should be added to your child theme functions.php file.

    Regards,
    Andre

    #1392533
    Massimo Clini
    Participant

    Hi, I’m your Pro customer, I used your code and it changed the check-in data type perfectly, but it didn’t change the check-out data type, how can I do it?

    #1392648
    J. Davis
    Keymaster

    Hi Massimo,

    Thanks for your question. You may use the code below:

    add_action( 'wp_head', 'remove_renderCheckOutDate' );
    function remove_renderCheckOutDate(){
    		remove_action( 'mphb_sc_checkout_form_booking_details', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderCheckOutDate' ) );
    }
    
    add_action( 'mphb_sc_checkout_form_booking_details', 'renderCheckOutDate' );
    function renderCheckOutDate( $booking ){
    		?>
    		<p class="mphb-check-out-date">
    			<span><?php esc_html_e( 'Check-out:', 'motopress-hotel-booking' ); ?></span>
    			<time datetime="<?php echo esc_attr( $booking->getCheckOutDate()->format( 'Y-m-d' ) ); ?>">
    				<strong>
    					<?php echo esc_html( \MPHB\Utils\DateUtils::formatDateWPFront( $booking->getCheckOutDate() ) ); ?>
    				</strong>
    			</time>,
    			<span>
    				<?php echo esc_html_x( 'until', 'until 10:00 am', 'motopress-hotel-booking' ); ?>
    			</span>
    			<time datetime="<?php echo esc_attr( MPHB()->settings()->dateTime()->getCheckOutTime() ); ?>">
    				<?php echo esc_html( MPHB()->settings()->dateTime()->getCheckOutTimeWPFormatted() ); ?>
    			</time>
    		</p>
    		<?php
    	}

    best regards,
    John Davis

    #1392664
    Massimo Clini
    Participant

    Thanks, but sadly even after pasting it in
    function.php does not give me the requested result, unfortunately the time in 12 hours continues to appear.
    Furthermore, even removing the AM writing from the code, it continues to appear on the wording and the time, while it has changed on check-in, has not changed on check-out.
    I attach an image to be clearer.
    Thank you so much for your kindness.

    Here as you can see it stayed 3 PM and 11AM While check in followed part of the script instructions, check out did not

    #1392751
    J. Davis
    Keymaster

    Hi Massimo,

    Thanks for your question. If you need to change the time format you may do this at Dashboard – Settings – General (WordPress settings). The plugin inherits the time format from WordPress settings.

    best regards,
    John Davis

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