Ecommerce Templates > General Help > Searching
Searching overview
You have already probably seen the inbuilt search feature in Ecommerce Templates but we have taken that further with some tweaks and tips below
- How to put a search box on each page
- How to search within price ranges
- How to link to search results
- The available parameters
How to put a search box on each page
Copy and paste these lines where you need the box to appear:
<form method="post" action="search.asp">
<input type="hidden" name="posted" value="1"/>
<input type="text" name="stext" size="16"/><br/>
<input type="submit" name="search"/>
</form>
Tips
Change search.asp to search.php for the PHP version
To search only within one category (In this case category 14) add
<input type="hidden" name="scat" value="14"/>
To search within several categories add:
<input type="hidden" name="scat" value="14,15,16">
To use an image instead of the grey submit button change
<input type="submit" name="search"/>
to
<input type="image" name="submit" src="images/search.gif"/>
To remove the search box from the results add
<input type="hidden" name="nobox" value="true"/>
How to search within price ranges
If you want to set up a simple link to search products priced between 100 and 200 you would need something like this:
<a href="search.php?pg=1&sminprice=101&sprice=200&nobox=true">100 - 200</a>
If you want to show a drop down menu of options then use the code below:
This goes before the closing </HEAD> tag
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
...and this goes where you want the drop down menu to appear...
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="#" selected>Please select</option>
<option value="search.php?pg=1&sminprice=0&sprice=10&nobox=true">under
10
<option value="search.php?pg=1&sminprice=10&sprice=100&nobox=true">10
- 100
<option value="search.php?pg=1&sminprice=101&sprice=200&nobox=true">101
- 200
</select>
</form>
How to link to search results
Rather than linking to complete categories, it is possible to narrow down the results returned by specifying the keyword in the search string. This is particularly useful if you want to pull specific words out of categories. For example this link will show all Dreamweaver products in category 12 with no search box (see below for an explanation of the available parameters).
search.asp?pg=1&stext=Dreamweaver&scat=12&stype=exact&nobox=true
The available parameters
stext: The text to be searched on
scat: The category number to be searched in, use commas between the numbers to search on multiple categories eg scat=12,13,14
stype: Can be any, exact or all
nobox=true: This will remove the search box from the search results page
sminprice: The minimum price parameter
sprice: the maximum price parameter
sman: This is to search by manufacturer eg, sman=xx - where xx is the id (Version 5.4 required).

