[ic] how to narrow current search results

Thanh Luong interchange-users@icdevgroup.org
Wed Sep 11 13:12:00 2002


I would like to modify some of my search pages to not
only produce the current results but have options at
the top to narrow the search further.
i have current three search pages
www.riptracing.com/cgi-bin/riptshop/brand.html
www.riptracing.com/cgi-bin/riptshop/carinfo.html
www.riptracing.com/cgi-bin/riptshop/producttype.html

for example on the first page, if some clicks GReddy.
The search results for all products matching Greddy
are displayed. however i would like to have the
options of narrowing the search further by the other
two options, either product type or car
info(make/model/yr).

here is the result page for the three links above
www.riptracing.com/cgi-bin/riptshop/results_with_options.html

here is the code for the page

[tmp matchlimit]20[/tmp]

<form action="[area search]" method=post>
<input type=hidden name=mv_session_id value="[data
session id]">
[seti asearch]
fi=products
st=db
su=yes
co=yes
ml=[scratch matchlimit]
[/seti]
<input type=hidden name=mv_profile value=asearch>
<table width=90% border="0">
<tr>
<td align=left>
<big><b>Search By: Make/Model/Year</b></big>
</td>
</tr>
<tr>
<td>  <b>Make</b></td>
<td>  <b>Model</b></td>
<td>  <b>Year</b></td>
</tr>
<tr>
<td>
<input type=text name=mv_searchspec size=20
maxlength=30>
<input type=hidden name=mv_search_field value=make>
  </td>
<td>
<input type=text name=mv_searchspec size=20
maxlength=30>
<input type=hidden name=mv_search_field value=model>
  </td>
<td>
<input type=text name=mv_searchspec size=20
maxlength=30>
<input type=hidden name=mv_search_field value=year>
  </td>
<td>
<input type="image" alt="Search"
src="__THEME_IMG_DIR__go.gif" border=0>
</td>
</tr>
</table>
</form>

<!--- END SEARCH BY MAKE/MODEL/YEAR --->

<!--- BEGIN SEARCH FOR BRAND--->
<table width=90%>
<tr>
<td align=left>
<form action="[area search]" method=post>
<input type=hidden name=mv_session_id value="[data
session id]">
<b><big>Search by Brand:  </big></b><select
name=mv_search_field>[loop search=|
     st=db 
     tf=brand 
     rf=brand 
     ra=yes
     un=yes 
|] 
    <a href="[area search=| 
        st=db 
        sf=brand
        ml=20
        se=[loop-code] 
    |]">[loop-code]</a><br>
<option value="[loop-code]">[loop-pos 0]
[/loop]
</select>
 
<input type="image" alt="Search"
src="__THEME_IMG_DIR__go.gif" border=0>
</form>
</td>
</tr>
</table>

<!--- END SEARCH FOR BRAND--->

<!--- BEGIN SEARCH FOR PRODUCT TYPE --->
<table width=90%>
<tr>
<td align=left>
<form action="[area search]" method=post>
<input type=hidden name=mv_session_id value="[data
session id]">
<b><big>Search by Product Type:  </big></b><select
name=mv_search_field>
[loop search=|
     st=db 
     tf=prod_group 
     rf=prod_group 
     ra=yes
     un=yes 
|] 
    <a href="[area search=| 
        st=db 
        sf=prod_group
        ml=20 
        se=[loop-code] 
    |]">[loop-code]</a><br>
<option value="[loop-code]">[loop-pos 0]
[/loop]
</select>
 
<input type="image" alt="Search"
src="__THEME_IMG_DIR__go.gif" border=0>
</form>
</td>
</tr>
</table>

<!--- END SEARCH FOR PRODUCT TYPE --->
The rest of the code is the same as the demo
results.html


So i'm guessing i need my code to look something like
this 

[if] link that brought you here=product type 
SHOW other search by brand AND search by make model
and year 
[else] link that brought you here=brand
SHOW search by product type AND search by make model
and year [/else]
[else]link that brought you here=make model and year
show search by brand and search by product type 
[/else]
[else] 
[/else]
[/if] 
I dont know the proper syntax for it or the variables
i need to call. maybe it should be done in an array
instead. well i dont. any suggestions? i am still a
novice to IC and programming in general. 

also for some reasons. the searches for brand and
product type are returning all my products(not just
products specified by the search). in addition to that
in lengths of 50 per page. instead of 20. i have ml=20

I am not sure if i have the right input
variables(type=hidden name=mv_session_id etc.) i am
not sure as to what exactly they do or if i have
redundant input variables. i have read the template
manual but it doesnt elaborate on it much

also the first part of product type should be AEM then
APC, the same goes for product type, it Air intake
systems then brakes. i dont cant figure why they are
being showed together like 1 and 2, 2 and 3, 3 and 4.
so on. i tried messing with the <options> tag and
changing the [loop-pos 1] but it ended up not showing
AEM at all just APC and on.

any help you can give me is greatly appreciated.
thanks in advance.
tom







__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute