With some basic HTML and a little JavaScript, it’s possible to create a search form in ShopSite that not only allows for keyword searching, but also provides drop-down lists for customers to select from.
In our first example, we will create a simple search form that allows a customer to search for a product’s Brand by selecting it from a drop-down list.
Before we begin building the form, some preparation is required to determine which values you would like to search for. We will be using the “Search Keywords” field available on each product as our search values. This field is a comma-delimited list of terms that we can use for brand names, product categories, or even price ranges, and is what our form will be searching against.
For our search on brand names, we will assume we have products under the brands “ABC” and “DEF”. Since these brand names could also be in product names we want to make sure our search is only for products with the correct words in the keyword field. Therefore we will use “brand_abc” and “brand_def” as our keywords.
For each product made by brand “ABC”, enter “brand_abc” in it’s keyword field. Then for each product made by brand “DEF”, enter “brand_def” in it’s keyword field. You will see how these values are used when we build our search form below.
The first step in building the form, is to obtain the current search form code that your website is using. View the source code on a page that uses ShopSite’s search field, and you will find code similar to what is shown below:
Original Search Code
<div id="search">
<form action="http://[domain and path to productsearch.cgi]?storeid=[your store id]" method="post">
<input type=hidden name="storeid" value="[your store id]">
<input type="text" name="search_field" class="search" size="13" onFocus="if(this.value=='Search')this.value='';" onBlur="if(this.value=='')this.value='Search';" value="Search">
<input type="submit" value="Go" name="Go" style="padding: 0px; margin: 0px;">
</form>
</div>