[ic] HELP: [if discount [item-code]] interpolation trouble

Ed LaFrance interchange-users@interchange.redhat.com
Wed Jan 30 13:19:01 2002


At 09:42 AM 01/30/2002 -0800, you wrote:
>Hello All,
>
>I'm building a catalog using Interchange 4.6.5 and MySQL.
>
>The catalog has several categories of products, and the descriptive
>information for items within each category varies. In order to keep things
>simple in the page templates, I've created a categories datatable that
>includes a field defining which product-data fields are used to create the
>item descriptions within that category. So instead of using
>[item-description], the description is built using a loop, like so:
>
>[loop arg="[catinfo-param desc_segments]"][item-param [loop-code]] [/loop]
>
>[catinfo-param desc_segments] is from a query that is run earlier in the
>template to select data from the categories table. Typical data would be
>something like:
>
>size,style,finish,shape
>
>The code above is in a results page. Users can search within each product
>category using a search form on another page.
>
>All was working fine until I started adding tags for discount information.
>In order to have the description loop display correctly, interpolate=1 must
>be set in the [search-region] tag. However, this causes [if discount
>[item-code]] to break. So instead of displaying what's inside the if tag, I
>just get a ].
>
>The way things are looking, I may need to find an alternate way to structure
>the search-region and related queries in order for everything to work
>together, maybe using some perl? Or is there some different syntax I can use
>for [if discount [item-code]] that will allow it to work within an
>interpolated search-region?
>
>I'm on a deadline for this project and need to have it working in the next
>two days. Please help with any suggestions on alternate search-region/query
>structures or tag syntax. I will provide complete source code if needed.
>
>Thank you in advance!

As a general rule, when positional parses fail, try named syntax instead:

[if type=discount term="[item-code]"]...[/if]

- 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
===============================================================