[ic] Re-Sorting Search Results within a page
Ed LaFrance
interchange-users@icdevgroup.org
Mon Dec 30 11:04:01 2002
At 10:36 AM 12/30/2002 +0000, you wrote:
>Ok. I must be thick. (Who said yes you are?!!)
>
>Anyway, after one to many sessions wading through the archives, I feel it is
>necessary to ask the question that has seemingly has never been answered!
>
>I have a results page (not results.html before anyway asks) that has a CGI
>variable passed into it. Which is then used to construct my search criteria
>like so:
>
> [search-region more=1 search="
> co=1
> op=em
> sf=shop
> se=cookshop
> op=em
> sf=category
> se=[scratch current_category]
> ml=21"]
>
>With me so far? Well anyway, what I would like to do on this page is give an
>option to select from a drop down list options such as "Sort by price,
>manufacturer" etc...etc. Kind of like what Amazon.com and others do.
>
>Has anybody managed to do this? If so could someone please help!!!!!
All you need is a form on your results page, something like this:
<form action="[process]" method=post>
<input type=hidden name=mv_todo value=return>
<input type=hidden name=mv_nextpage value=@@MV_PAGE@@>
<select name=sort_field onChange="this.form.submit()">
[loop arg="category manufacturer price"]
<option value="[loop-code]"
[selected name=sort_field value="[loop-code]"]> Sort by [loop-code]
[/loop]
</select>
<input type=submit value="Sort">
</form>
...then just ad the sort_field to your search:
[search-region
more=1
search="
co=1
op=em
sf=shop
se=cookshop
op=em
sf=category
se=[scratch current_category]
tf=[value sort_field]
[if value sort_field eq price]to=n[/if]
ml=21"
]
Note that I kludged in numeric sorting for the price field only - the
default sort type is alpha, I believe.
- Ed L.
_______________________________________________________________
«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
New Media E.M.S. Technology Solutions for Business
463 Main St., Suite D eCommerce | Consulting | Hosting
Placerville, CA 95667 edl@newmediaems.com
(530) 622-9421 http://www.newmediaems.com
(866) 519-4680 Toll-Free (530) 622-9426 Fax
_______________________________________________________________
«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯