[ic] Strange Sorting Results

Stefan Hornburg racke at linuxia.de
Wed Sep 15 13:03:15 EDT 2004


On Wed, 15 Sep 2004 16:51:34 +0100
"Adrian P Wilkinson" <junk at puffin.org> wrote:

> Hi Group,
> 
> I (with a little bit of help from some IRC users) wrote a little bit of code 
> a while ago that compiled a drop-down box of brand names (i.e. Hewlett 
> Packard, Apple, etc) and allowed the user to click 'Go!' to display all 
> products by that vendor.  Here's the code:
> 
> [timed-build period="1 hour" file=timed/list_of_mfr force=1]
> <FORM ACTION="[area search]" METHOD="POST">
>         <INPUT TYPE="hidden" NAME="sf" VALUE="vendor">
>         <SELECT NAME="se" WIDTH="20">
>         [query sql="SELECT DISTINCT vendor FROM products ORDER BY vendor" 
> list=1]
>           <option value="[sql-param vendor]" selected>[sql-filter 
> 20.][sql-param vendor][/sql-filter]</option>
>         [/query]&nbsp;<input type=submit value="Go!">
>           </SELECT>
>       </FORM>
> [/timed-build]
> 
> I've now noticed two very strange little problems with this:
> 
> 1.  Despite the menu being built from the data available in the tables, it 
> won't find certain vendors ("no results") in the list it has populated; an 
> example of this is "XFX - PINE VGA CARDS" so I suspect that it's the space 
> or the length of the string or something along those lines.

Try an exact search:

<input type="hidden" name="co" value="1">
<input type="hidden" name="op" value="eq">

> 
> 2.  The sorting order is supposed to be by product_group and category, i.e.
> 
>        Storage / CD-RW Drives
>        - Product 1
>        - Product 2
>        - Product 3
> 
>        Storage / DVD-ROM Drives
>        - Product 4
>        - Product 5
> 
>        ToSortOut / ToSortOut
>        - Product 6
>        - Product 7
> 
>     However, the results come out as follows (for example):
> 
>        Storage / CD-RW Drives
>        - Product 1
>        - Product 2
> 
>        Storage / DVD-ROM Drives
>        - Product 4
> 
>        Storage / CD-RW Drives
>        - Product 3
> 
>        ToSortOut / ToSortOut
>        - Product 6
> 
>        Storage / DVD-ROM Drives
>        - Product 5
> 
>        ToSortOut / ToSortOut
>        - Product 7

You need to instruct IC to sort the search results:

tf=product_group,category

Bye
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list