Display Availability Calendar in case 0 accomodations found

Free and Premium WordPress Plugins & Themes Forums WordPress Themes Alpenhouse Display Availability Calendar in case 0 accomodations found

  • This topic has 3 replies, 3 voices, and was last updated 1 month ago by J. Davis.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #897003
    Van Hove
    Participant

    Hello

    Is this ‘easy’ to do with AlpenHouse Theme and Elementor:
    in case the Search Availability results in “0 accomodations …”, we want to display the Availability calendar unter that result, to encourage the customer/guest to look for other dates.
    Can I do this with the available elements in AlpenHouse theme and Elementor?
    Regards,
    Carine

    #899298
    Steve
    Keymaster

    Hello Van Hove,

    I don’t see any solution with Elementor but you can copy
    \plugins\motopress-hotel-booking\templates\shortcodes\search-results\results-info.php
    to your theme
    you_theme_name\hotel-booking\shortcodes\search-results\results-info.php
    and add [mphb_availability_search] shortcode to display a form or just a “Back to Search” button.

    Skills in php are required.

    #902004
    Van Hove
    Participant

    Hello Steve,
    I hope i understood correctly. I have a child theme alpenhouse-child under which i have now copied the parent’s results-info.php file.
    How can i now have the availability calendar shown under the default no-accommodations-found text? What should i add where in the else-clause of below code.
    I indeed have no PHP-knowledge indeed but i turst WP is also for non-PHP programmers, so i guess it must be possible to work safely in a child-theme file with your help i guess.
    Look forward to your reply.
    Carine

    
    <?php
    /**
     * Available variables
     * - int $roomTypesCount count of found rooms
     * - int $adults
     * - int $children
     * - string $checkInDate date in human readable format
     * - string $checkOutDate date in human readable format
     */
    if ( !defined( 'ABSPATH' ) ) {
    	exit;
    }
    ?>
    <p class="mphb_sc_search_results-info">
    	<?php
    	if ( $roomTypesCount > 0 ) {
    		printf( _n( '%s accommodation found', '%s accommodations found', $roomTypesCount, 'motopress-hotel-booking' ), $roomTypesCount );
    	} else {
    		_e( 'No accommodations found', 'motopress-hotel-booking' );
    	}
    	printf( __( ' from %s - till %s', 'motopress-hotel-booking' ), $checkInDate, $checkOutDate );
    //	printf( __( ' for adults: %d, children: %d', 'motopress-hotel-booking' ), $adults, $children );
    //	printf( __( ' from %s - till %s', 'motopress-hotel-booking' ), $checkInDate, $checkOutDate );
    	?>
    </p>
    #907388
    J. Davis
    Keymaster

    Hi Carine,

    Thank you for your question. Yes, you will need to add /hotel-booking/shortcodes/search-results/ folders inside of child theme folder so complete directory structure will look like this

    alpenhouse-child\hotel-booking\shortcodes\search-results\

    you should paste the copy of results-info.php file from this folder

    \plugins\motopress-hotel-booking\templates\shortcodes\search-results\

    Then edit results-info.php file at new destination adding
    echo do_shortcode('[mphb_availability_search]'); e.g.

    <?php
    /**
     * Available variables
     * - int $roomTypesCount count of found rooms
     * - int $adults
     * - int $children
     * - string $checkInDate date in human readable format
     * - string $checkOutDate date in human readable format
     */
    if ( !defined( 'ABSPATH' ) ) {
    	exit;
    }
    ?>
    <p class="mphb_sc_search_results-info">
    	<?php
    	if ( $roomTypesCount > 0 ) {
    		printf( _n( '%s accommodation found', '%s accommodations found', $roomTypesCount, 'motopress-hotel-booking' ), $roomTypesCount );
    	} else {
    		_e( 'No accommodations found', 'motopress-hotel-booking' );
    	}
    	printf( __( ' from %s - till %s', 'motopress-hotel-booking' ), $checkInDate, $checkOutDate );
    	echo do_shortcode('[mphb_availability_search]');
    //	printf( __( ' for adults: %d, children: %d', 'motopress-hotel-booking' ), $adults, $children );
    //	printf( __( ' from %s - till %s', 'motopress-hotel-booking' ), $checkInDate, $checkOutDate );
    	?>
    </p>

    Best regards,
    J. Davis

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