WSN Classifieds https://scripts.webmastersite.net/wsnclassifieds/manual en-us Searching by Coordinates Sometimes you may wish to construct a search (either as a link or as a form) which will show everything within x distance of a given set of latitude a https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/searching-by-coordinates-659.html Tue, 31 Oct 2017 12:18:23 GMT https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/searching-by-coordinates-659.html
A complete search link with a 50 mile range and no search term filtering for the coordinates 37.316,-120.042 would be yoursiteurl/search.php?condition=or&filled=1&search=&whichtype=links&zipmiles=50&zipsource[0]=37.316&zipsource[1]=-120.042

To construct a complete search form, just copy the simple or advanced search form and add the zipsource[0], zipsource[1] and zipmiles as hidden inputs. To construct a search link that filters in any desired way, simply run the desired search, copy the url from your browser address bar, and add the three paramaters &zipmiles=50&zipsource[0]=37.316&zipsource[1]=-120.042 to the end of the url.

If you just want to show stuff near the person who's reading the page, you can use zipsource=visitorlocation]]>
Combination Simple and Advanced Search Sometimes you may wish to blend the simple search box and advanced field filter searches. As of version 10.1.6 Beta 4 and later, this is now possible. https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/combination-simple-and-advanced-search-655.html Tue, 21 Mar 2017 20:51:09 GMT https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/combination-simple-and-advanced-search-655.html
Start with your advanced search form. To construct a custom advanced search form, one easy approach is to use your browser's "view source" option when viewing the advanced search page on your site. Then use ctrl+f to locate "Find Listings". Copy that whole box and then remove whichever listing fields you don't want searched in your custom form.

To incorporate the simple search box into the custom advanced search box you've made, let's make it the first row of the table just below <table> like this:
<tr><td>Any searchable field</td><td><select name="condition">{FUNC_SIMPLESEARCHCONDITIONOPS}</select></td><td><input type="text" name="search" class="standardinput" placeholder="type your simple search term here"></td></tr>


If you prefer not to allow a choice of condition for the simple search, replace the condition selector with <input type="hidden" name="condition" value="{DEFAULTSEARCHTYPE}"> to use the default simple search type automatically.]]>
Searching with Checkboxes Adding custom field searches to the advanced search page that use checkboxes to search. https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/searching-with-checkboxes-540.html Tue, 02 Mar 2010 03:49:21 GMT https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/searching-with-checkboxes-540.html
Open your advanced search template (Admin Panel -> Themes -> Manage Templates -> "Advanced Search") or whichever template you're constructing a search form in. For a checkbox search for a multiple checkbox (or multiple selector) field, place this in the search form HTML:
<input type="hidden" name="multicheckcondition" value="or" >
multicheck: <input type="checkbox" name="multichecksearch[]" value="one" > one <input type="checkbox" name="multichecksearch[]" value="two" > two <input type="checkbox" name="multichecksearch[]" value="three" > three


Replace 'multicheck' with the name of your field and the numbers one through three with the possible values of your field. You can extend this to any number of options.

Please note that with the "or" value on mutlicheckcondition the search will return a listing if any of the searcher's checked boxes are checked on the listing. If you want to only match in the event that all of the searcher's checked boxes are also checked on the listing, change it to an "and" search: <input type="hidden" name="multicheckcondition" value="and" >

For a checkbox search for a single checkbox field (just on or off), use this HTML:
<input type="hidden" name="singlecheckcondition" value="=" >
<input type="checkbox" name="singlechecksearch" value="singlecheck" > singlecheck


Replace 'singlecheck' with the name of your field.]]>
Location Filtering Filtering from country to state or province and finally down to city. https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/location-filtering-536.html Tue, 22 Dec 2009 10:50:35 GMT https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/location-filtering-536.html
Add the following in your advanced search form to accomplish this. Requires having the postal code range search switch on, and databases loaded for the countries you need in this chained selector. The postal database must have the states in the same format as the listings have (can't abbreviate on one and not on the other).

<IF {SWITCH_ZIPRANGE}>
<script type="text/javascript">
function statefilter()
{
var thecountry = $("[name=countrysearch]").val();
$.post("{SUBDIRURL}/ajax.php",{ action: 'getstates', country: thecountry },
function(xml)
{
$("[name=statesearch]").html(xml);
});

}
function cityfilter()
{
var thestate = $("[name=statesearch]").val();
var thecountry = $("[name=countrysearch]").val();
$.post("{SUBDIRURL}/ajax.php",{ action: 'getcities', state: thestate, country: thecountry },
function(xml)
{
$("[name=citysearch]").html(xml);
});
}
</script>

<p>Filter to your desired location, starting with the country:</p>
<br >Country:
<input type="hidden" name="countrycondition" value="=" >
<select name="countrysearch" onchange="statefilter()"><option value=""></option>{COUNTRYOPS}</select>
<br >State/Territory:
<input type="hidden" name="statecondition" value="=" >
<select name="statesearch" onchange="cityfilter()"><option value=""></option></select>
<br >City:
<input type="hidden" name="citycondition" value="=" >
<select name="citysearch"><option value=""></option></select>
</IF>
]]>
Searching by State Allowing visitors to search listings in their preferred states. https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/searching-by-state-494.html Fri, 10 Oct 2008 15:48:38 GMT https://scripts.webmastersite.net/wsnclassifieds/manual/configuration/searching/searching-by-state-494.html Here's a common scenario: you want to allow your visitors to search for listings within the states of their choice, multiple-choice. Here's an example search form you can use:

<form action="search.php?action=filter&filled=1&whichtype=links" method="post">
<p>Choose the states you want to search in:</p>
<table>
<tr>
<td valign="top">
<input type="hidden" name="statecondition" value="or" >
<input type="checkbox" name="statesearch[]" value="select all" onclick="checkuncheckstates()" > All States<br >
<input type="checkbox" name="statedirectoriessearch[]" value="Alabama" > Alabama<br ><input type="checkbox" name="statedirectoriessearch[]" value="Alaska" > Alaska<br ><input type="checkbox" name="statedirectoriessearch[]" value="American Samoa" > American Samoa<br ><input type="checkbox" name="statedirectoriessearch[]" value="Arizona" > Arizona<br ><input type="checkbox" name="statedirectoriessearch[]" value="Arkansas" > Arkansas<br ><input type="checkbox" name="statedirectoriessearch[]" value="California" > California<br ><input type="checkbox" name="statedirectoriessearch[]" value="Colorado" > Colorado<br ><input type="checkbox" name="statedirectoriessearch[]" value="Connecticut" > Connecticut<br ><input type="checkbox" name="statedirectoriessearch[]" value="Delaware" > Delaware<br ><input type="checkbox" name="statedirectoriessearch[]" value="District Of Columbia" > District Of Columbia<br ><input type="checkbox" name="statedirectoriessearch[]" value="Federated States Of Micronesia" > Federated States Of Micronesia<br ></td><td valign="top"><input type="checkbox" name="statedirectoriessearch[]" value="Florida" > Florida<br ><input type="checkbox" name="statedirectoriessearch[]" value="Georgia" > Georgia<br ><input type="checkbox" name="statedirectoriessearch[]" value="Guam" > Guam<br ><input type="checkbox" name="statedirectoriessearch[]" value="Hawaii" > Hawaii<br ><input type="checkbox" name="statedirectoriessearch[]" value="Idaho" > Idaho<br ><input type="checkbox" name="statedirectoriessearch[]" value="Illinois" > Illinois<br ><input type="checkbox" name="statedirectoriessearch[]" value="Indiana" > Indiana<br ><input type="checkbox" name="statedirectoriessearch[]" value="Iowa" > Iowa<br ><input type="checkbox" name="statedirectoriessearch[]" value="Kansas" > Kansas<br ><input type="checkbox" name="statedirectoriessearch[]" value="Kentucky" > Kentucky<br ></td><td valign="top"><input type="checkbox" name="statedirectoriessearch[]" value="Louisiana" > Louisiana<br ><input type="checkbox" name="statedirectoriessearch[]" value="Maine" > Maine<br ><input type="checkbox" name="statedirectoriessearch[]" value="Marshall Islands" > Marshall Islands<br ><input type="checkbox" name="statedirectoriessearch[]" value="Maryland" > Maryland<br ><input type="checkbox" name="statedirectoriessearch[]" value="Massachusetts" > Massachusetts<br ><input type="checkbox" name="statedirectoriessearch[]" value="Michigan" > Michigan<br ><input type="checkbox" name="statedirectoriessearch[]" value="Minnesota" > Minnesota<br ><input type="checkbox" name="statedirectoriessearch[]" value="Mississippi" > Mississippi<br ><input type="checkbox" name="statedirectoriessearch[]" value="Missouri" > Missouri<br ><input type="checkbox" name="statedirectoriessearch[]" value="Montana" > Montana<br ></td><td valign="top"><input type="checkbox" name="statedirectoriessearch[]" value="Nebraska" > Nebraska<br ><input type="checkbox" name="statedirectoriessearch[]" value="Nevada" > Nevada<br ><input type="checkbox" name="statedirectoriessearch[]" value="New Hampshire" > New Hampshire<br ><input type="checkbox" name="statedirectoriessearch[]" value="New Jersey" > New Jersey<br ><input type="checkbox" name="statedirectoriessearch[]" value="New Mexico" > New Mexico<br ><input type="checkbox" name="statedirectoriessearch[]" value="New York" > New York<br ><input type="checkbox" name="statedirectoriessearch[]" value="North Carolina" > North Carolina<br ><input type="checkbox" name="statedirectoriessearch[]" value="North Dakota" > North Dakota<br ><input type="checkbox" name="statedirectoriessearch[]" value="Northern Mariana Islands" > Northern Mariana Islands<br ><input type="checkbox" name="statedirectoriessearch[]" value="Ohio" > Ohio<br ></td><td valign="top"><input type="checkbox" name="statedirectoriessearch[]" value="Oklahoma" > Oklahoma<br ><input type="checkbox" name="statedirectoriessearch[]" value="Oregon" > Oregon<br ><input type="checkbox" name="statedirectoriessearch[]" value="Palau" > Palau<br ><input type="checkbox" name="statedirectoriessearch[]" value="Pennsylvania" > Pennsylvania<br ><input type="checkbox" name="statedirectoriessearch[]" value="Puerto Rico" > Puerto Rico<br ><input type="checkbox" name="statedirectoriessearch[]" value="Rhode Island" > Rhode Island<br ><input type="checkbox" name="statedirectoriessearch[]" value="South Carolina" > South Carolina<br ><input type="checkbox" name="statedirectoriessearch[]" value="South Dakota" > South Dakota<br ><input type="checkbox" name="statedirectoriessearch[]" value="Tennessee" > Tennessee<br ><input type="checkbox" name="statedirectoriessearch[]" value="Texas" > Texas<br ></td><td valign="top"><input type="checkbox" name="statedirectoriessearch[]" value="Utah" > Utah<br ><input type="checkbox" name="statedirectoriessearch[]" value="Vermont" > Vermont<br ><input type="checkbox" name="statedirectoriessearch[]" value="Virgin Islands" > Virgin Islands<br ><input type="checkbox" name="statedirectoriessearch[]" value="Virginia" > Virginia<br ><input type="checkbox" name="statedirectoriessearch[]" value="Washington" > Washington<br ><input type="checkbox" name="statedirectoriessearch[]" value="West Virginia" > West Virginia<br ><input type="checkbox" name="statedirectoriessearch[]" value="Wisconsin" > Wisconsin<br ><input type="checkbox" name="statedirectoriessearch[]" value="Wyoming" > Wyoming<br >
</td>
</tr>
</table>

<br >Search for listings where the name contains
<input type="hidden" name="titlecondition" value="like" >
<input type="text" size="{STANDARDSIZE}" name="titlesearch" >
<br ><br >
<br ><input type="submit" value="Run Search" class="button" >

</form>


In Admin Panel -> Themes -> Manage Templates -> Extra Javascript Inclusions, insert this:

<script type="text/javascript">
function checkuncheckstates()
{
var boxes = document.getElementsByName('statedirectoriessearch[]');
for (i=1; i < boxes.length; i++)
{
if (boxes[i].checked == true) boxes[i].checked = false;
else boxes[i].checked = true;
}
}
</script>

This will display all the states (or provinces, depending on default country), 10 per column, with checkboxes and select all option.

]]>