To answer your question faster, you can search our knowledgebase articles before submitting a ticket.
Knowledgebase
WPL shortcode filter for MLS On The Fly (sf_on_the_fly)
Posted by Kian K. on 24 September 2024 06:36 PM

Step 1: Understanding sf_on_the_fly

The sf_on_the_fly shortcode parameter allows you to filter listings dynamically using OData queries. These queries can be used to filter listings based on various criteria like city, price, property type, etc.

Step 2: Structure of OData Queries

OData queries follow the format of {Field} {Operator} {Value}. Here are some common OData operators:

eq:Equalto
ne:Notequalto
gt:Greaterthan
ge:Greaterthanorequalto
lt:Lessthan
le:Lessthanorequalto
and:Combinemultipleconditions ● or:Combinemultipleconditions

Step 3: Applying Filters Using WPL Shortcode

The basic syntax of the WPL shortcode with sf_on_the_fly looks like this:

shortcode
Copy code
[WPL sf_on_the_fly="Your Query Here"]

Now, let's look at specific examples.

Example 1: Filter Listings by City

To display listings where the city is "Imperial", you can use:

shortcode
Copy code
[WPL sf_on_the_fly="City eq 'Imperial'"]

This OData query will fetch all properties where the city is exactly "Imperial".

Example 2: Filter Listings by Price

To display listings where the price is greater than or equal to $200,000:

shortcode
Copy code
[WPL sf_on_the_fly="ListPrice ge 200000"]

This will filter all properties that are listed for $200,000 or more.

Example 3: Filter Listings by City and Price

To combine filters for city and price, use the and operator:

shortcode
Copy code
[WPL sf_on_the_fly="City eq 'Imperial' and ListPrice ge 200000"]

This will display properties located in "Imperial" with a list price of $200,000 or more.

Step 4: Advanced Filtering

You can add more complex conditions by chaining multiple filters using and or or operators. For example, to filter listings in "Imperial" where the price is greater than or equal to $200,000 and less than $500,000:

shortcode
Copy code
[WPL sf_on_the_fly="City eq 'Imperial' and ListPrice ge 200000 and ListPrice lt 500000"]

Step 5: Custom Field Filtering

If you want to filter based on custom fields (e.g., number of bedrooms or property type), you'll need to use the field names defined in your MLS setup. For example, to filter listings for properties with at least 3 bedrooms:

shortcode
Copy code
[WPL sf_on_the_fly="Bedrooms ge 3"]

Step 6: Troubleshooting

  1. Empty Listings: If no listings appear, ensure that your OData query syntax matches the field names and values in your MLS setup.

  2. Multiple Conditions: When combining multiple conditions, always use and or or operators.

Conclusion

With the sf_on_the_fly shortcode parameter, you can dynamically filter property listings using OData queries. By understanding the query structure, you can create advanced filters for city, price, and other custom fields.


Comments (0)