[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [mv] Fix flypage foundation 4.7.5
Quoting Ton Verhagen (ton@verhagen.net):
> Dear All,
>
> Just encountered a minor thing.
>
> Need to add op=eq to the search in the loop over the specs.txt file.
>
> Without op=eq the search will return all specs for all product codes like
> D5001, D5001-HP, D5001-E etc.
> for item-code is D5001.
You are right.
If anyone is interested, what Ton is talking about is a technique
which I have used for a few years but never put in the demo.
(Originally inspired by the Techdata's specification spreadsheets
and Greg Hansen.)
If you want variable specs for a product without having to manage
field names, you use a file like:
code sku sort header detail
os28069 000 Case material Painted Steel
os28069 000 Hinge material Galvanized
os28069 000 Latch material Stainless Steel
os28069 000 Height 14"
os28069 000 Width 24"
os28069 000 Depth 10"
And a loop like:
[if file products/specs.txt]
[loop search="
fi=specs.txt
st=text
sf=sku
se=[item-code]
op=eq
co=yes
tf=sort
rf=header,detail
"][on-match]
<tr>
<td style="contentbar1" colspan=2><img src="bg.gif" alt="" height=3>
</tr>
[/on-match]
[list]<tr>
<td style="contentbar1">
<B>[loop-param header]:</b>
</td>
<td>
[loop-param detail]
</td>
</tr>
[/list]
[on-match]
<tr>
<td style="contentbar1" colspan=2><img src="bg.gif" alt="" height=3>
</tr>
[/on-match]
[/loop]
[/if]
It need not be an Interchange database table -- text file search works
OK. For very large databases, you would either put it in SQL with an
indexed field, or use the mv_dict_look feature (and move SKU to the
first field). You can select specs from a 20MB file in milliseconds
with mv_dict_look, which uses Search::Dict for a binary search.
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer
_______________________________________________
Minivend-users mailing list
Minivend-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/minivend-users