[ic] Loop Search Question
Jon Jensen
jon at endpoint.com
Thu Jul 17 00:12:34 UTC 2008
On Wed, 16 Jul 2008, William Fiore wrote:
> I have the following component that displays the latest 3 items added to
> the store. I want to limit the results to products that do not have an
> image name of "default.gif" (products with a image named default.gif are
> usually so new that they are missing not only images, but descriptions
> and pricing as well).
>
> [loop search="fi=products/st=db/co=1/sf=date_added/op=le/nu=0/ml=3/tf=date_added/to=r"]
> <p><a href="[area [loop-code]]">[loop-field title]</a> - <br><span
> class="content_left_top_bold">[loop-code] ([convert-date
> format="%m-%d-%Y"][loop-field date_added][/convert-date])</span></p>
> [/loop]
Hi, Bill.
I find that this is where SQL shines and Interchange's built-in search is
a burden. I'd rewrite it as SQL so it's easier to add whatever clauses you
want. Something like this should work:
[query
sql="
SELECT code, title, date_added
FROM products
WHERE image <> 'default.gif'
ORDER BY date_added DESC
LIMIT 3
"
prefix=loop
]
<p><a href="[area [loop-code]]">[loop-field title]</a> etc. etc.
[/query]
Jon
--
Jon Jensen
End Point Corporation
http://www.endpoint.com/
More information about the interchange-users
mailing list