[ic] Strange Sorting Results

Ed LaFrance (New Media E.M.S.) ic_users at newmediaems.com
Wed Sep 15 13:14:15 EDT 2004


At 08:51 AM 9/15/2004, you 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.
>
>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
>
>Is anyone able to offer any pointers as to how to resolve these two 
>annoying little problems?  Thanks in advance for any help offered.
>
>Regrads, Ade.

You may be right about the spaces or special characters. There are also no 
sorting parameters in the form.  Try this:

<FORM ACTION="[area search]" METHOD="POST">
        <INPUT TYPE="hidden" NAME="sf" VALUE="vendor">
         <input type=hidden name=ac value=yes>
         <input type=hidden name=em value=yes>
         <input type=hidden name=tf value="prod_group,category">
        <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>

...don't forget to disable timed-build so you can see the change take effect.

- Ed


===============================================================
New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          Ed.LaFrance at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax
=============================================================== 



More information about the interchange-users mailing list