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

Thomas J.M. Burton interchange-users@interchange.redhat.com
Thu Jan 31 20:45:01 2002


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]


___________________________________
Thomas J.M. Burton, Design/Production
Global Focus Digital Media, LLC
www.globalfocusdm.com
[541] 342.5717