COMPLETE: Rooms features

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)

These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.

  • Author
    Posts
  • #4041
    Alex
    Spectator

    Hi Merv!
    Before me the task to organize search by number of rooms (not bed or bathrooms, and all rooms in property).

    After several days of editing the code in Your plugin I added to the admin panel in “Edit Listing (Property and Rentals) – Listing Features – House Features” new line “Rooms”. Also on the list “All Listing” (Property and Rentals) in the column “Listing Details” is shown as “Beds” and “Baths”. And added in search widget – checkbox “Rooms”. Brought to the page “Single listing” in section “Property Features”, but could not overpower the conclusion of icons (such as the “pool” and “beds”) and did not work to add to the search widget.
    Please tell me where necessary to make editing the code to display the icon and search field in the widget.

    I attached to post archive with only files in which i made the changes.
    P.S. Sorry for the huge number of letters 🙂

    Here list of changes:
    1. In “/lib/includes/class-property-meta.php” added after line #485:

    	// property rooms
    	public function get_property_rooms($returntype = 'i') {
    		if($this->get_property_meta('property_rooms') == '')
    			return;
    		$rooms['i'] = '<span title="'.__('Rooms', 'epl').'" class="icon rooms"><span class="icon-value">'. $this->get_property_meta('property_rooms') . '</span></span>'; 
    		$rooms['d'] = $this->get_property_meta('property_rooms') . ' '.__('rooms', 'epl').' ';
    		$rooms['l'] = '<li class="rooms">' . $this->get_property_meta('property_rooms') . ' '.__('rooms', 'epl').'</li>';
    		return $rooms[$returntype];
    	}

    2. In “/lib/includes/template-functions.php” added after line #653:
    'property_rooms',

    3. In “/lib/compatibility/listing-meta-compat.php” added after line #203:
    $property_rooms = '';
    after line #274 added:

    	if(isset($meta['property_rooms'])) {
    		if(isset($meta['property_rooms'][0])) {
    			$property_rooms = $meta['property_rooms'][0];
    		}	
    	}

    after line #660 added:

    if(isset($property_rooms) && $property_rooms != 0) {
    	$i_rooms = '<span title="'.__('Rooms', 'epl').'" class="icon rooms"><span class="icon-value">' . $property_rooms  . '</span></span>'; 
    	$d_rooms = $property_rooms . ' '.__('rooms', 'epl').' ';
    	$l_rooms = '<li class="rooms">' . $property_rooms . ' '.__('rooms', 'epl').'</li>';
    }

    after line #990 added:

    if(isset($i_room)) {
    	$property_icons_full .= $i_room;
    }

    after line #1020 added:

    if(isset($l_room)) {
    	$the_property_feature_list .= $l_room;
    }

    4. In “/lib/meta-boxes/meta-boxes.php” after line #278 added:

     array(
    	'name'		=>	'property_rooms',
    	'label'		=>	__('Rooms', 'epl'),
    	'type'		=>	'number',
    	'maxlength'	=>	'2'
     ),

    5. In “/lib/post-types/post-type-property.php” after line #125 added:
    $rooms = get_post_meta( $post_id, 'property_rooms', true );

    after line #134 changed:

    if ( !empty( $beds ) || !empty( $baths ) || !empty( $rooms ) ) {
    echo '<div class="epl_meta_beds_baths">';
    echo '<span class="epl_meta_beds">' , $beds , ' ' , __( 'Beds', 'epl' ) , ' | </span>';
    echo '<span class="epl_meta_baths">' , $baths , ' ' , __( 'Baths', 'epl' ) , ' | </span>';
    echo '<span class="epl_meta_rooms">' , $rooms , ' ' , __( 'Rooms', 'epl' ) , '</span>';
    echo '</div>';
    }

    6. In “/lib/post-types/post-type-rental.php” after line #124 added:
    $rooms = get_post_meta( $post_id, 'property_rooms', true );

    after line #134 changed:

    if ( !empty( $beds ) || !empty( $baths ) || !empty( $rooms ) ) {
    echo '<div class="epl_meta_beds_baths">';
    echo '<span class="epl_meta_beds">' , $beds , ' ' , __( 'Beds', 'epl' ) , ' | </span>';
    echo '<span class="epl_meta_baths">' , $baths , ' ' , __( 'Baths', 'epl' ) , ' | </span>';
    echo '<span class="epl_meta_rooms">' , $rooms , ' ' , __( 'Rooms', 'epl' ) , '</span>';
    echo '</div>';
    }

    7. In “/lib/post-types/post-type-rural.php” after line #126 added:
    $rooms = get_post_meta( $post_id, 'property_rooms', true );

    after line #137 changed:

    if ( !empty( $beds ) || !empty( $baths ) || !empty( $rooms ) ) {
    echo '<div class="epl_meta_beds_baths">';
    echo '<span class="epl_meta_beds">' , $beds , ' ' , __( 'Beds', 'epl' ) , ' | </span>';
    echo '<span class="epl_meta_baths">' , $baths , ' ' , __( 'Baths', 'epl' ) , ' | </span>';
    echo '<span class="epl_meta_rooms">' , $rooms , ' ' , __( 'Rooms', 'epl' ) , '</span>';
    echo '</div>';
    }

    8. In “/lib/shortcodes/shortcode-listing-search.php” after line #33 added:
    'search_room' => 'on', // on or off

    after line #297 added:

    if ( $search_rooms == 'on' &&  $post_type != 'land' ) {  ?>
    	<div class="fm-block bdr-btm">
    	<label for="property_rooms" class="fm-label"><?php _e('Rooms:', 'epl'); ?></label>
    	<div class="field">
    	<select name="property_rooms" id="property_rooms" class="in-field field-width">
    	<option value=""><?php _e('Any', 'epl'); ?></option>
    <?php
    	$room_arr = array(
    		'1'	=>	'1',
    		'2'	=>	'2',
    		'3'	=>	'3',
    		'4'	=>	'4',
    		'5'	=>	'5',
    	);
    	foreach($room_arr as $k=>$v) {
    		$selected = '';
    		if(isset($property_rooms) && $k == $property_rooms) {
    			$selected = 'selected="selected"';
    		}
    	echo '<option value="'.$k.'" '.$selected.'>'. __($v, 'epl') .'</option>';
    	}
    ?>
    	</select>
    	</div>
    	</div>
    	<?php
    }
    ?>

    9. In “/lib/templates/content/content-listing-search.php” after line #43 added:

    if(!empty($property_rooms)) {
    	$meta_query[] = array(
    		'key'		=>	'property_rooms',
    		'value'		=>	$property_rooms,
    		'compare'	=>	'>='
    	);
    }

    10. In “/lib/widgets/widget-listing-search.php” after line #28 added:
    'search_rooms' => 'on',

    after line #60 added:
    $instance['search_rooms'] = strip_tags($new_instance['search_rooms']);

    after line #79 added:
    'search_rooms' => 'on',

    after line #97 added:
    $search_rooms = esc_attr($instance['search_rooms']);

    after line #168 added:

    <p>
    <input id="<?php echo $this->get_field_id('search_rooms'); ?>" name="<?php echo $this->get_field_name('search_rooms'); ?>" type="checkbox" <?php if(isset($search_rooms) && $search_rooms == 'on') { echo 'checked="checked"'; } ?> />
    <label for="<?php echo $this->get_field_id('search_rooms'); ?>"><?php _e('Rooms', 'epl'); ?></label>
    </p>
    • This topic was modified 9 years, 3 months ago by Alex.
    • This topic was modified 9 years, 3 months ago by Merv Barrett.
    • This topic was modified 9 years, 1 month ago by Merv Barrett.
    Attachments:
    You must be logged in to view attached files.
    #4058
    Merv Barrett
    Keymaster

    This is great, i’ve moved to feature requests forum. Thanks for your assistance. Its better to use Github, make your changes and push to the repo. That way I can test and merge your changes

    #4061
    Alex
    Spectator

    OK, I already added changes and sent pull request.
    P.S. If something is wrong – I’m new to using git 🙂

    I hope you can help!
    Thank U!

    #6232
    Merv Barrett
    Keymaster

    This has finally been added to 2.1

    Thanks for your help, me made so many changes that i had to get 2.0 our first. I’d like to list you as a contributor on the github page, I might get you to make a minor change text or something so you can be listed.

    #6234
    Merv Barrett
    Keymaster
    #6253
    Alex
    Spectator
    This reply has been marked as private.

These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘COMPLETE: Rooms features’ is closed to new replies.