Skip to content

Commit

Permalink
Add support for salesOffice filter
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyReichert committed Feb 24, 2024
1 parent 706d81e commit bc1be7f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/assets/js/simply-rets-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ function normalizeParameters(params) {
return obj.maxGarageSpaces = params[key]
if (key === "salesagent")
return obj.salesAgent = params[key]
if (key === "salesoffice")
return obj.salesOffice = params[key]
if (key === "speciallistingconditions")
return obj.specialListingConditions = params[key]

Expand Down
19 changes: 16 additions & 3 deletions src/simply-rets-post-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public static function srInitRewriteRules() {
}

public static function srAddRewriteRules($incoming) {
$rules = array(
$rules = array(
'listings/([^&]+)/([^&]+)/([^&]+)/([^&]+)/([^&]+)/?$' => 'index.php?sr-listings=sr-single&sr_city=$matches[1]&sr_state=$matches[2]&sr_zip=$matches[3]&listing_title=$matches[4]&listing_id=$matches[5]',
'listings/(.*)/(.*)?$' => 'index.php?sr-listings=sr-single&listing_id=$matches[1]&listing_title=$matches[2]'
);
'listings/(.*)/(.*)?$' => 'index.php?sr-listings=sr-single&listing_id=$matches[1]&listing_title=$matches[2]'
);

return $incoming + $rules;
}
Expand Down Expand Up @@ -186,6 +186,7 @@ public static function srQueryVarsInit( $vars ) {
$vars[] = "sr_areaMinor";
$vars[] = "sr_ownership";
$vars[] = "sr_salesAgent";
$vars[] = "sr_salesOffice";
$vars[] = "sr_agent";
$vars[] = "sr_brokers";
$vars[] = "sr_sort";
Expand Down Expand Up @@ -814,6 +815,16 @@ public static function srPostDefaultContent( $content ) {
$salesAgent_att = $salesAgentData["att"];
$salesAgent_query = $salesAgentData["query"];

/** Parse multiple salesOffice's from short-code parameter */
$salesOfficeData = SimplyRetsCustomPostPages::parseGetParameter(
"sr_salesOffice",
"salesOffice",
$_GET
);

$salesOffice_att = $salesOfficeData["att"];
$salesOffice_query = $salesOfficeData["query"];

/** Parse multiple cities from short-code parameter */
$citiesData = SimplyRetsCustomPostPages::parseGetParameter(
"sr_cities",
Expand Down Expand Up @@ -969,6 +980,7 @@ public static function srPostDefaultContent( $content ) {
"areaMinor" => $areaMinor_att,
"ownership" => $ownership_att,
"salesAgent" => $salesAgent_att,
"salesOffice" => $salesOffice_att,
"agent" => $agent_att,
"brokers" => $brokers_att,
"style" => $style_att,
Expand Down Expand Up @@ -1008,6 +1020,7 @@ public static function srPostDefaultContent( $content ) {
. $areaMinor_query
. $ownership_query
. $salesAgent_query
. $salesOffice_query
. $statuses_string
. $amenities_string
. $exteriorFeatures_query
Expand Down
4 changes: 4 additions & 0 deletions src/simply-rets-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public static function attributeNameToParameter($name) {
"mingaragespaces" => "minGarageSpaces",
"maxgaragespaces" => "maxGarageSpaces",
"salesagent" => "salesAgent",
"salesoffice" => "salesOffice",
"subtypetext" => "subTypeText",
"speciallistingconditions" => "specialListingConditions",
"areaminor" => "areaMinor"
Expand Down Expand Up @@ -332,6 +333,7 @@ public static function sr_search_form_shortcode( $atts ) {
$areaMinor = isset($atts['areaminor']) ? $atts['areaminor'] : '';
$ownership = isset($atts['ownership']) ? $atts['ownership'] : '';
$salesAgent = isset($atts['salesagent']) ? $atts['salesagent'] : '';
$salesOffice = isset($atts['salesoffice']) ? $atts['salesoffice'] : '';

if($config_type === '') {
$config_type = isset($_GET['sr_ptype']) ? $_GET['sr_ptype'] : '';
Expand Down Expand Up @@ -586,6 +588,7 @@ public static function sr_search_form_shortcode( $atts ) {
<input type="hidden" name="sr_areaMinor" value="<?php echo $areaMinor; ?>" />
<input type="hidden" name="sr_ownership" value="<?php echo $ownership; ?>" />
<input type="hidden" name="sr_salesagent" value="<?php echo $salesAgent; ?>" />
<input type="hidden" name="sr_salesoffice" value="<?php echo $salesOffice; ?>" />
<input type="hidden" name="grid_view" value="<?php echo $grid_view; ?>" />

<div>
Expand Down Expand Up @@ -692,6 +695,7 @@ public static function sr_search_form_shortcode( $atts ) {
<input type="hidden" name="sr_areaMinor" value="<?php echo $areaMinor; ?>" />
<input type="hidden" name="sr_ownership" value="<?php echo $ownership; ?>" />
<input type="hidden" name="sr_salesagent" value="<?php echo $salesAgent; ?>" />
<input type="hidden" name="sr_salesoffice" value="<?php echo $salesOffice; ?>" />

</form>
</div>
Expand Down

0 comments on commit bc1be7f

Please sign in to comment.