[ic] AdvancedSearch - hiding a prod_group - category names
repeated
John Matecsa
interchange-users@icdevgroup.org
Thu Feb 20 14:38:01 2003
Got it! Replacing the loop with a query using the SQL statement
containing 'distinct' did the trick. Code follows in case your curious.
On Tue, 2003-02-18 at 14:09, John Matecsa wrote:
> In the course of hiding the existence of a prod_group called "Kits" from
> most users I've bumped into a snag in advancedsearch.html.
>
> Ideally the following would appear in the drop down list.
>
> select distinct category from products where products.prod_group !=
> 'Kits' order by category;
>
> But in drop down list below, each category name is repeated for each
> instance in products.
>
> How does one do the SQL equivalent of 'distinct' within the search?
>
> I tried using un=yes to no avail.
> I tried removing sku, from rf, but the resulting list was blank.
>
> Just in case it matters.. we are running IC 4.8.6 with mySQL 3.23.52 on
> RedHat 7.0
>
> Thanks in advance for any suggestions!
>
>
> <form action="[area search]" method=post>
> <input type=hidden name=mv_session_id value="[data session id]">
> <input type=hidden name=mv_substring_match value="Yes">
> <input type=hidden name=mv_search_map value="
> mv_searchspec=search1
> mv_searchspec=search2
> ">
> <input type=hidden name=mv_search_field value="category">
> <input type=hidden name=mv_search_field value="*">
>
> <table>
> <tr>
> <td>
> <b>[LC]Search by Category[fr_FR]Recherche par
> catégorie[/fr_FR][/LC]:</b><br>
> [LC]Search for[fr_FR]Recherche pour[/fr_FR][/LC]
> <input type="text" name=search2 value="">
> [LC]in the[fr_FR]dans le ou la[/fr_FR][/LC]
> <select name=search1>
>
[comment]
> [loop option=category search="
> co=yes
> sf=prod_group
> se=Kits
> nu=0
> op=!~
> ra=yes
> fi=products
> rf=sku,category
> un=yes
> ml=1000
> tf=category
> "]
> <option value="[loop-data products category]">
> [LOC][loop-data products category][/LOC]</option>
> [/loop]
[/comment]
[query sql="SELECT DISTINCT category FROM products WHERE prod_group !=
'Kits' order by category" type="list" prefix="item"
list_prefix="products"]
<option value="[item-param category]">
[LOC][item-param category][/LOC]</option>
[/query]
> </select>
> [LC]category.[fr_FR]catégorie[/fr_FR][/LC]
> <input type="image" alt="Search" src="__THEME_IMG_DIR__go.gif"
> border=0>
>
> </td>
> </tr>
> </table>
>
> </form>
--
John Matecsa <matecsaj@picassofish.com>
Picasso Fish Corporation