By default, your main listings page orders the information alphabetically by the address field. But what if
you want to sort by some other field, like price? To do this, what you can do is link directly to the
search engine instead, and use it to search by a specific field.
Here's an example of how to create a link that links directly to the search results of all of your listings
sorted by price.
- First go to Realty Manager's setup options and make sure "Enable database sorting?" is set to "yes".
- Open up your _search_query.html template file (stored in your /templates/_realty/ directory) and add the following.
(Make sure to add this somewhere between the open <form> and closing </form> tag).
<input type="hidden" name="sort_order" value="5,123,forward">
By default field 5 is the price field, so we enter in '5' as the value. If you use a different database field
number to store the price information you'll want to make the appropriate changes. Also, replace 'forward' with
'reverse' if your want your listings to be sorted with the most expensive listings first.
- Now go to your search query page in your browser (/exec/search.cgi). To get there, you can just click
on "Search Listings" from one of the pages generated by Realty Manager. Perform a generic search (don't fill
out any of the search fields - just click search.) This search should return all of your listings.
Note: you can also specify the results to be shown per page with the "perpage" field in your search
form (/templates/_realty/_search_query.html). You'll need to add (or modify) a hidden input element containing
this information:
<input type="hidden" name="perpage" value="10">
Feel free to change the value "10" to accommodate however many results you want each page to display.
- Next, copy and paste the search results URL from your browsers address bar. Replace this URL with the URL
you normally use to link people to the HTML file listings index. You'll probably want to make this URL
replacement in all 6 of your template files.
- Now when people click on "view our listings" they'll be taken to the entire search results of all of
your listings, displaying 10 listings per page, and sorting by price.