Skip to content

Commit

Permalink
Merge pull request #49 from SimplyRETS/wip-results-list-baths-total
Browse files Browse the repository at this point in the history
Prioritize 'bathrooms' over 'bathsFull' in results list
  • Loading branch information
CodyReichert committed Jun 8, 2017
2 parents 0e8abec + d4483b0 commit 5119734
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.3.0
* FEATURE: Prioritize bathrooms over bathsFull in results list details
* UPDATE: Update compatibility with latest WordPress version 4.8

## 2.2.6
* FEATURE: Add admin option to use "statusText" API field in place of the standardized status.

Expand Down
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Author: SimplyRETS
Contributors: SimplyRETS
Tags: rets, idx, real estate listings, real estate, listings, rets listings, simply rets, realtor, rets feed, idx feed
Requires at least: 3.0.1
Tested up to: 4.7.2
Stable tag: 2.2.6
Tested up to: 4.8
Stable tag: 2.3.0
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -235,8 +235,12 @@ listing sidebar widget.

== Changelog ==

= 2.3.0 =
* FEATURE: Prioritize bathrooms over bathsFull in results list details
* UPDATE: Update compatibility with latest WordPress version 4.8

= 2.2.6 =
* FEATURE: Add admin option to use "statusText" API field in place of the standardized status.
* FEATURE: Add admin option to use "statusText" API field in place of the standardized status.

= 2.2.5 =
* FEATURE: Add contact form info (name, email, listing) to the end of the email message body.
Expand Down
21 changes: 15 additions & 6 deletions simply-rets-api-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static function srApiOptionsRequest( $url ) {
$php_version = phpversion();
$site_url = get_site_url();

$ua_string = "SimplyRETSWP/2.2.6 Wordpress/{$wp_version} PHP/{$php_version}";
$ua_string = "SimplyRETSWP/2.3.0 Wordpress/{$wp_version} PHP/{$php_version}";
$accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json";

if( is_callable( 'curl_init' ) ) {
Expand Down Expand Up @@ -209,7 +209,7 @@ public static function srApiRequest( $url ) {
$wp_version = get_bloginfo('version');
$php_version = phpversion();

$ua_string = "SimplyRETSWP/2.2.6 Wordpress/{$wp_version} PHP/{$php_version}";
$ua_string = "SimplyRETSWP/2.3.0 Wordpress/{$wp_version} PHP/{$php_version}";
$accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json";

if( is_callable( 'curl_init' ) ) {
Expand Down Expand Up @@ -1305,7 +1305,6 @@ public static function srResidentialResultsGenerator( $response, $settings ) {
* TODO: Create a ranking system 1 - 10 to smartly replace missing values
*/
$bedsMarkup = SimplyRetsApiHelper::resultDataColumnMarkup($bedrooms, 'Bedrooms');
$bathsMarkup = SimplyRetsApiHelper::resultDataColumnMarkup($bathsFull, 'Full Baths');
$areaMarkup = SimplyRetsApiHelper::resultDataColumnMarkup(
$area, '<span class="sr-listing-area-sqft">SqFt</span>'
);
Expand All @@ -1324,9 +1323,19 @@ public static function srResidentialResultsGenerator( $response, $settings ) {
$yearMarkup = SimplyRetsApiHelper::resultDataColumnMarkup($subdivision, "");
}

if(empty($bathsFull) || $bathsFull == 0 && is_numeric($bathsTotal)) {
$realBaths = $bathsTotal + 0;
$bathsMarkup = SimplyRetsApiHelper::resultDataColumnMarkup($realBaths, "Bath");

/**
* Get the 'best' number for the total baths.
* Prioritize 'bathrooms' (eg, total baths) over
* bathsFull, and only fallback to bathsFull if bathrooms
* is not available.
*/
$bathsMarkup;
if(is_numeric($bathsTotal)) {
$total_baths = $bathsTotal + 0; // strips extraneous decimals
$bathsMarkup = SimplyRetsApiHelper::resultDataColumnMarkup($total_baths, 'Bath');
} else {
$bathsMarkup = SimplyRetsApiHelper::resultDataColumnMarkup($bathsFull, 'Full Baths');
}


Expand Down
2 changes: 1 addition & 1 deletion simply-rets.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: https://simplyrets.com
Description: Show your Real Estate listings on your Wordpress site. SimplyRETS provides a very simple set up and full control over your listings.
Author: SimplyRETS
Version: 2.2.6
Version: 2.3.0
License: GNU General Public License v3 or later
Copyright (c) SimplyRETS 2014 - 2015
Expand Down

0 comments on commit 5119734

Please sign in to comment.