Miva Merchant 4 Module FAQs » Search Manager (BROK_SEARCH)


{docurl}

Adding a Static Search Form

How do I add a static search form to my store, for example, on the store front?

To add a "static" search field to your store you can use the code:

<FORM METHOD = "post" ACTION ="http://www.yourstore.com/Merchant2/merchant.mv?>
<INPUT TYPE = "hidden" NAME = "Store_Code" VALUE = "storecode">
<INPUT TYPE = "hidden" NAME = "Screen" VALUE = "SRCHM">
<INPUT TYPE="hidden" NAME="Search_desc" VALUE="0">
<INPUT TYPE="hidden" NAME="Search_name" VALUE="1">
<INPUT TYPE = "hidden" NAME = "BrokSearch_Have_List_Fields" VALUE="1">
<b>Search for:</b><INPUT TYPE="text" NAME="Search_search" SIZE="15" VALUE="">

<input type="image" name="submit">
</form>

The "Search_desc" and "Search_name" variables represent the search options (i.e. search description and search name). A value of 1 means that field will be searched. The other fields:

Search_attrib
Search_weight
Search_desc
Search_price
Search_image
Search_thumb
Search_code
Search_name
Search_phrase
Search_case
Search_keys
Search_whole
Search_and
Search_ctgy

To search the fields of the Additional Fields Manager, you would use the field id (shown on the "Additional Fields" tab) such as:
<input type="hidden" name="SearchAdd_1" value="1">
where "1" is the field id.

It is also possible to provide a URL/Link which contains the terms to be searched:

http://www.yourstore.com/Merchant2/merchant.mv?Store_Code=storecode&Screen=SRCHM&Search_name=1&HF=1&Search_Search=dog

As in the form above, the Search_name=1 means that the name field would be searched. You could add other fields by adding those to the url:
http://www.yourstore.com/Merchant2/merchant.mv?Store_Code=storecode&Screen=SRCHM&Search_name=1&Search_desc=1&HF=1&Search_Search=dog

If you want to search a term w/ spaces in it you need to replace the spaces w/ +. So to search dog catcher you would have Search_Search=dog+catcher

It is actually possible to shorten the URL/form but it gets a little more complex. The search options are passed to the page in the variable SearchOptions, which is a "binary" representation of the options. So if ALL options had been selected by the customer it would look like 11111111111111. If only the AND option had been selected, then it would look like 00000000000010.

The positions, left to right, are:

Search_attrib position 1
Search_weight position 2
Search_desc position 3
Search_price position 4
Search_image position 5
Search_thumb position 6
Search_code position 7
Search_name position 8
Search_phrase position 9
Search_case position 10
Search_keys position 11
Search_whole position 12
Search_and position 13
Search_ctgy position 14

So to search the name and description you would have the URL:

http://www.yourstore.com/Merchant2/merchant.mv?Store_Code=storecode&Screen=SRCHM&SearchOptions=00100001000000&HF=1&Search_Search=dog

Similarly, there is a string for the Additional Fields: AddOptions (eg. AddOptions=1|4). In this case the positions are actually the field ids (as listed on the Additional Fields Manager tab). So if you want to automatically search field ids 1 and 4, you would have AddOptions=1|4.

So to search Additional Fields 1 and 2 your URL would become:

http://www.yourstore.com/Merchant2/merchant.mv?Store_Code=S&Screen=SRCHM&SearchOptions=00100001000000&HF=1&AddOptions=1|2&Search_Search=dog

This may seem longer than the original URL but that URL only searched the name field and this is as long as the URL will get regardless of the number of options you want to include.



Last update: 2003-07-31 00:49
Author: Support
Revision: 1.0

Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 1 out of 5 (1 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry

Records in this category