Miva Merchant 4 Module FAQs » Search Manager (BROK_SEARCH)


{docurl}

Is it possible to restrict a search to a particular price range?

(2004/03/11)Yes. The module can search for prices within a particular price range. To add this capability to the module, you need to use the "Use template formatting?" option (on the "options" tab).

Within the form in the "Main template" area (i.e. between the %beginform% and %endform%) you can place the token:

%pricerange1|xx|%

to display a search field, xx characters long, to collect the bottom of the range. Similarly, you use the token:

%pricerange2|xx|%

to display a search field, xx characters long, to collect the top of the range. The module will then restrict the search to only those products which have a price between the value entered into the two fields (actually, it will return all products which have a price equal to or greater than the value in %pricerange1|xx|% and lower than or equal to the value in %pricerange2|xx|%.

If no value is entered into the %pricerange2|xx|% field, then the search will return all products with a price higher or equal to the value entered into the %pricerange1|xx|% field.

The module will also take into account the other options and any search term entered into the search field. So if you enter "banana" into the search field and a price range of 0 to 30, the module would find only products in the price range from 0 to 30 AND with "banana" in the searched fields. However, it is not necessary that some value be in the search field (eg. not necessary that the form variable Search_search have a value). If not search term is entered, the module will return all active products in that price range.

By way of example, to offer your customers the ability to restrict the results to products with a price only within a particular range, you could add the following to your "main template" between the %beginform% and %endform% tokens:

Prices from: %pricerange1|3|% to %pricerange2|03|%

It's also possible to offer the price range capability by adding form fields directly to the template. You can use the variables, Search_pricerange1 and Search_pricerange2, to collect the data for the lower and upper price ranges, respectively. For example:

<input type="text" name="Search_pricerange1" value="">
<input type="text" name="Search_pricerange2" value="">

You can also use the variable, Search_pricerange (i.e. without the 1 or 2 suffix), which must have a value in the form "lower price:upper price". This is for use in Select type lists and radio buttons. For example, to offer the ability to select price ranges from a select list, you could add to the "main template" (again between the %beginform% and %endform% token) the html:

<select name="Search_pricerange">
<option value="0:10">$0 to $10</option>
<option value="10:20">$10 to $20</option>
<option value="20:30">$20 to $30</option>

<option value="30:">over $30</option>
</select>

NOTE that the price used is the value in the Products database for the product; it does NOT take into account discount for price groups, etc.



Last update: 2005-01-12 08:32
Author: Support
Revision: 1.0

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

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry

Records in this category