[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] FYI: Product Search by Alphabet
Hi all,
In the search of the archives I never found a suitable solution for creating
a index for my catalogues. The task was to replicate an index as in a
printed catalogue.
This creates a link bar on top like this: A | B | C | D | E | F etc etc...
but with pretty pictures. eg "images_menu/tab_a.gif"
products_index.txt is a table of with columns code & title where title
contains the text to search for in the products.txt column called index
eg the product_index.txt file
code title
1 Machines - Overhead Projectors
2 OHP & Supplies - OHP
3 OHP & Supplies - Overhead Projector
The column index can contain a list of possible ways to look up a product
eg the product.txt file
title:"3M 2000 Overhead Projector"
index:"Machines - Overhead Projectors / OHP & Supplies - OHP / OHP &
Supplies - Overhead Projector"
of course this is probably only one of many solutions and I found it
suitable to my sites, with modifications it can be used to extract a
category list from the product.txt file.
--------------- start
file="templates/components/alpha_menu" -------------------
[perl]
$menu = " ";
$letter = " ";
for ($i = 65; $i < 88 ; $i++){
$letter = chr($i);
$menu .= "[page scan fi=products_index\.txt
co=yes
se=$letter\%
op=LIKE
sf=title
tf=title
to=f
sp=@@MV_PAGE@@
ml=999]<img
src=\"images_menu/tab_\l$letter.gif\"
alt=\"$letter\"
border=\"0\"
width=\"20\"
height=\"20\">";
}
$menu .= "[page scan fi=products_index\.txt
co=yes
se=X\%
op=ge
sf=title
tf=title
to=f
sp=@@MV_PAGE@@
ml=999]<img
src=\"images_menu/tab_xyz.gif\"
alt=\"XYZ\"
border=\"0\"
height=\"20\">";
return $menu;
[/perl]
--------------- end
file="templates/components/alpha_menu" -------------------
--------------- start index results page -------------------
<!-- BEGIN CONTENT -->
<h1>Product Index</h1>
<h3>[include file="templates/components/alpha_menu"]</h3>
[search-region]
[no-match]
<BR><BR><BLOCKQUOTE>
Sorry, no matches for <B>[value-extended name=mv_searchspec joiner=" |
"]</B>.
[if value mv_search_error]
<P><B>Errors:
<BR> [value-extended name=mv_search_error joiner="<BR>"]
</B>
[/if]
<BR><BR></BLOCKQUOTE>
[/no-match]
<BR CLEAR=LEFT>
[more-list]
<BLOCKQUOTE>
[more]<BR>
</BLOCKQUOTE>
[/more-list]
<ul>
[search-list]
[on-change header][condition][item-data product_index
title][/condition]
<li><FONT FACE="verdana,arial,helvetica">
<A HREF="[area href=scan
arg=|
sf=index
em=1
ac=1
se=[item-data product_index title]
tf=title
to=f
ml=10
|
]">[filter name namecase][item-data product_index
title][/filter]</A>
</font></li>
[/on-change header]
[/search-list]
</ul>
[/search-region]
<P ALIGN=CENTER>
<!-- current page: @@MV_PAGE@@ -->
<!-- END CONTENT -->
--------------- end index results page -------------------
Regards
Greg Heath
Pacific Tecnologies International P/L
www.pacifictech.com.au
greg@pacifictech.com.au
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users