[ic] Multiple fields for DescriptionField?

Thomas J.M. Burton tom at globalfocusdm.com
Tue Dec 7 00:47:49 UTC 2010

On 12/6/2010 3:58 PM, Rick Bragg wrote:
> On Mon, 2010-12-06 at 13:50 -0800, Thomas J.M. Burton wrote:
>> Hi all,
>> I'm wondering if there's some way to assign multiple fields for the
>> DescriptionField config directive. I have a catalog that uses various
>> fields to assemble product descriptions and I'm looking into ways to
>> make the code that does so more efficient.
>> For example, rather than [item-description] returning the value of an
>> item's description field, I'd want it to return the values of fields
>> desc01, desc03 and desc04 separated by spaces.
>> I've tried a simple test with an Autoload sub that changes the
>> DescriptionField and tried a comma-separated set of two field names
>> which didn't work.
>> I suppose I could write a UserTag that would override [item-description]
>> (or [PREFIX-description], I suppose), but would like to know if there
>> may be a better way of accomplishing this.
>> The catalog is running in IC 5.4.2 and uses a MySQL database. (Yes, I
>> know I need to upgrade IC).
>> Thanks,
>> Tom
> First; Upgrade right away.
> Then, maybe a query tag, with something like
> [query
>     type=list
>     sql=|
>     SELECT desc01, desc03, desc04
>     FROM products
>     WHERE sku = ...
>     LIMIT 0,1
>     |]
> [sql_list]
>    [tmp description][sql-param desc01] [sql-param desc03] [sql-param
> desc04][/tmp]
> [/sql_list]
> [/query]
> Also consider containing this in a timed build, or caching this out in
> some way for speed...

Thanks, Rick.

I've already worked out something similar to using a query tag and put 
it together as a UserTag that runs a query like "SELECT CONCAT_WS(' ', 
desc01,desc03,desc04) FROM products WHERE sku='...'", delivering the 
result cleanly directly from the query.

Due to some other complexities in this system that I chose not to 
mention, I was thinking it might be a more elegant approach if I could 
use the DescriptionField directive instead. I'm guessing that probably 
won't work with multiple fields though, so I'll just go with my UserTag 

Your comment about the timed build or caching brings up my next 
question. What would be the most efficient approach to storing these 
product descriptions once they've been queried so that they can be used 
elsewhere in the catalog (e.g. cart page, search results, order reports, 
etc) without requiring repetitive database queries?

My guess is that storing each one as a scratch value may not be the best 
option, since a large number of stored values would easily build up in 
sessions as users browse this particular catalog.

I'd welcome any suggestions for efficient storage of these descriptions.

Thanks again,

Global Focus Digital Media, LLC


More information about the interchange-users mailing list