diff --git a/simply-rets-api-helper.php b/simply-rets-api-helper.php index 6080d1c..e5fa116 100644 --- a/simply-rets-api-helper.php +++ b/simply-rets-api-helper.php @@ -988,8 +988,6 @@ public static function srResidentialDetailsGenerator( $listing ) { !empty($vendor) ? array("sr_vendor" => $vendor) : array() ); - $addrFull = $address . ', ' . $city . ' ' . $listing_postal_code; - /** * Google Map for single listing */ @@ -1301,8 +1299,8 @@ public static function srResidentialResultsGenerator( $response, $settings ) { * Listing status to show. This may return a statusText. */ $mls_status = SrListing::listingStatus($listing); + $full_address = SrUtils::buildFullAddressString($listing); - $addrFull = $address . ', ' . $city . ' ' . $zip; $listing_USD = $listing_price == "" ? "" : '$' . number_format( $listing_price ); if( $bedrooms == null || $bedrooms == "" ) { @@ -1349,7 +1347,7 @@ public static function srResidentialResultsGenerator( $response, $settings ) { $iwCont = SrSearchMap::infoWindowMarkup( $link, $main_photo, - $address, + $full_address, $listing_USD, $bedrooms, $bathsFull, @@ -1423,8 +1421,9 @@ public static function srResidentialResultsGenerator( $response, $settings ) {
-

$address - $listing_USD

+

$full_address + - $listing_USD +

diff --git a/simply-rets-maps.php b/simply-rets-maps.php index 4206fd0..6ac29a9 100644 --- a/simply-rets-maps.php +++ b/simply-rets-maps.php @@ -104,7 +104,7 @@ public static function infoWindowMarkup( $markup = << -

$address $price

+

$address - $price

diff --git a/simply-rets-utils.php b/simply-rets-utils.php index 079b338..1d65f77 100644 --- a/simply-rets-utils.php +++ b/simply-rets-utils.php @@ -98,6 +98,25 @@ public static function normalizeCountyText($county) { return $county_text; } + /** + * Render a listings full address with state and postalCode + * , , + */ + public static function buildFullAddressString($listing) { + + $city = $listing->address->city; + $state = $listing->address->state; + $zip = $listing->address->postalCode; + $address = $listing->address->full; + + // A listing might have a null address if a flag like "Display + // address" is set to false. This just removes the comma in + // these cases, but the rest of the address remains the same. + $comma = $address ? ', ' : ''; + + return $address . $comma . $city . ', ' . $state . ' ' . $zip; + } + /** * Builds a link to a listings' details page. Used in search results. */ @@ -122,25 +141,11 @@ public static function buildDetailsLink($listing, $params = array()) { // Listing details $listing_id = $listing->mlsId; - $listing_city = $listing->address->city; $listing_state = $listing->address->state; $listing_zip = $listing->address->postalCode; $listing_address = $listing->address->full; - - // A listing might not have a null address if a flag like - // "Display address" is set to false. This just removes the - // comma in these cases, but the rest of the address remains - // the same. - $comma = $listing_address ? ', ' : ''; - - $listing_address_full = $listing_address - . $comma - . $listing_city - . ', ' - . $listing_state - . ' ' - . $listing_zip; + $listing_address_full = SrUtils::buildFullAddressString($listing); if($prettify && $custom_permalink_struct === "pretty_extra") {