From b18da27fbb11aecb2169d966206a0c282d7c9d9d Mon Sep 17 00:00:00 2001 From: Grant Eagon Date: Thu, 12 Dec 2024 14:38:33 -0500 Subject: [PATCH] Update simply-rets-shortcode.php Add filter for price="Reduced" for when listPrice is lower than originalListPrice. --- src/simply-rets-shortcode.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/simply-rets-shortcode.php b/src/simply-rets-shortcode.php index 5ba93ec..9ca8081 100644 --- a/src/simply-rets-shortcode.php +++ b/src/simply-rets-shortcode.php @@ -277,7 +277,7 @@ public static function sr_openhouses_shortcode($atts = array()) { * to show a single listing. * ie, [sr_residential mlsid="12345"] */ - public static function sr_residential_shortcode($atts = array ()) { + public static function sr_residential_shortcode($atts = array()) { $setting_atts = array( "map_position" => get_option('sr_search_map_position', 'map_above'), "grid_view" => false, @@ -285,17 +285,22 @@ public static function sr_residential_shortcode($atts = array ()) { "vendor" => "", "limit" => 20 ); - + $data = SrShortcodes::parseShortcodeAttributes($atts, $setting_atts); - + + // Add filter for type="Reduced" + if (!empty($atts['type']) && strtolower($atts['type']) === 'reduced') { + $data["params"]["listPrice__lt"] = "originalListPrice"; // Assuming this is the correct filter key + } + // Use /properties/:id if `mlsid` parameter is used - if(!empty($atts['mlsid'])) { + if (!empty($atts['mlsid'])) { $qs = "/{$atts['mlsid']}" - . !empty($atts['vendor']) ? "&vendor={$atts['vendor']}" : ""; - + . (!empty($atts['vendor']) ? "&vendor={$atts['vendor']}" : ""); + return SimplyRetsApiHelper::retrieveRetsListings($qs, $data["settings"]); } - + return SimplyRetsApiHelper::retrieveRetsListings( $data["params"], $data["settings"]