[ic] Need help building [item-param] tags

Ed LaFrance interchange-users@interchange.redhat.com
Fri Feb 1 12:36:00 2002


At 05:44 PM 01/31/2002 -0800, you wrote:
>Hello,
>
>Could someone please help me with an alternate approach to the following?
>I'm running Interchange 4.6.5 and using MySQL with it.
>
>I have a table in my database called categories. It contains information
>about the product categories offered in the catalog. A field named
>desc_segments contains a comma-separated list of field names to use for a
>product's description.
>
>Example:
>code    desc_segments
>foo    size,shape,color,style
>
>What I'm trying to do is take the contents of the desc_segments field for a
>given category and expand it into [item-param] tags that will be parsed and
>make up a product's description.
>
>In other words, size,shape,color,style would become
>
>[item-param size] [item-param shape] [item-param color] [item-param style]
>
>inside a [search-list] container. These would then be parsed and produce the
>corresponding values for each product in the list, like so:
>
>[item-param size] [item-param shape] [item-param color] [item-param style]
>
>becomes
>
>4mm round blue faceted
>
>I've been able to produce the [item-param] tags with a loop, but they aren't
>parsed unless I have interpolate=1 set in the [search-region] tag, which I
>don't want to do.
>
>I'm wondering if I might be able to get the same end results using some
>embedded PERL, but I'm not experienced enough with PERL to know how to
>approach it. How should I go about this?
>
>Thanks in advance...
>
>
>Current Approach:
>Note: [value cat] is set on a previous page.
>
>[query list=1
>     sql="SELECT *
>             FROM categories
>             WHERE code='[value cat]'"
>     prefix=catinfo
>     list_prefix=catinfo]
>
>   [catinfo]
>     [seti desc_segments][catinfo-param desc_segments][/seti]
>   [/catinfo]
>[/query]
>
>[search-region]
>     [search-list]
>         [item-code]
>         [loop arg="[scratch desc_segments]"][item-param [loop-code]] [/loop]
>         [item-price]
>     [/search-list]
>[/search-region]
>
>

I'm not sure I understand how this is supposed to work.  Is the [query] 
only supposed to return one row?  And what is feeding the [search-list] here?

- Ed L.


===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================