Adding links to searches and mini-search forms to your site

If you want to add a link to your site that will show all products that meet a certain criteria, there are two methods of doing this.

 

Method one uses the shopsearch.asp page and is limited to only searching the keywords field of the product record.

 

Your link or form needs to go to the shopsearch.asp page and two pieces of information are required to be passed along with this link:

 

1.  Search = YES – this tells VPCART that you want to run a search.

2.  Keyword –this is a comma-delimited list of keywords to search for.

 

Hyperlink example –

 

<a href="shopsearch.asp?search=YES&keyword=abc,def,jkl">Search for keywords</a>

 

Form Example –

 

<form method=”post” action=”shopsearch.asp”>

      <input type=”hidden” name=”search” value=”YES” />

      <input type=”text” name=”keyword” value=”” />

      <input type=”submit” value=”Search” />

</form>

 

 

Method two uses shopquery.asp, which is much more powerful, as it allows you to specify searches on any field in the products table.

 

Your link or form needs to go to shopquery.asp and you need to pass pairs of name/value strings to the link to tell VPCART what to search on.

 

You can also pass a template to display the results with by adding template=templatename.htm to the link (where templatename.htm is the actual name of your template file).

 

Hyperlink examples –

 

<a href="shopquery.asp?cprice=50&cname=shirt">Display Shirts</a>

<a href="shopquery.asp?cprice=50&cname=shirt&template=shirttemplate.htm">Display Shirts</a>

 

Form example –

 

<form method="POST" action="shopquery.asp">

Name: <input type="text" name="cname" size="30" />

<br />Manufacturer <input type="text" name="mfg" size="30" />

<br />Price<input type="text" name="cprice" size="30" />

<br /><input type="submit" value="Display" name="Shopquery" />

</form>

 

By default, shopquery.asp will try to find the information, such as shirt in the example above, anywhere in the specified field. If you want to find only products where the keyword is the first few characters of the field, you need to add queryprefix=No to your link or form.

 

Hyperlink example -

 

<a href="shopquery.asp?cname=shirt&queryprefix=No">Display Shirts</a>

 

Form example -

 

<form method="POST" action="shopquery.asp">

Name: <input type="text" name="cname" size="30" />

<input type=”hidden” name=”queryprefix” value=”No” />

<br /><input type="submit" value="Display" name="Shopquery" />

</form>

 

If you want to use shopquery.asp to search for products in a specific price range, you can do so by adding lowprice=value to your querystring or form.

 

Hyperlink example -

 

<a href="shopquery.asp?cname=shirt&lowprice=10&cprice=50">Display Shirts</a>

 

Form example -

 

<form method="POST" action="shopquery.asp">

Name: <input type="text" name="cname" size="30" />

<input type=”text” name=”lowprice” value=”10” />

<input type=”text” name=”cprice” value=”50” />

<br /><input type="submit" value="Display" name="Shopquery" />

</form>

 

The examples above will return shirts between $10 and $50.