Author Topic

steve walker

Monday 30 August 2004 8:38:03 am

Comment41347

Hi there,

I am struggling with the syntax adding a variable into a fetch.

I have a fetch that works fine:

{let exactresults=fetch(content,tree,hash(parent_node_id, 59, 
attribute_filter,  
array(and,array('stone_product/carat','in','(7)'), 
array('stone_product/clarity','in','(7)')))) }

This is using Paul's contributed patch found at http://ez.no/community/contributions/hacks/more_attribute_filter_operators_and_fetch_by_owner_id

This fetch lives in the form posted earlier in the thread. I'm trying to add the value of a GET variable into this fetch so that the fetch takes the value from the form, and have almost working code:

{let carat=ezhttp( 'search_carat', 'get' )}
{let exactresults=fetch(content,tree,hash(parent_node_id, 59, 
attribute_filter,  
array(and,array('stone_product/carat','in','($carat)'), 
array('stone_product/clarity','in','(7)'))))
 }
PRINT THE VARIABLE {$carat}

What I'm seeing is that the variable $carat exists and has been GET'd properly (as its displayed via "PRINT THE VARIABLE {$carat}"), but the fetch doesnt use the variable in this manner.

Debug says:
<i>
Query error: Unknown column '$carat' in 'where clause'. Query: SELECT ezcontentobject.*,
</i>

So it seems that the fetch believes $carat is a dbase column.

Can anyone tell me how to change the syntax of

{let exactresults=fetch(content,tree,hash(parent_node_id, 59, 
attribute_filter,  
array(and,array('stone_product/carat','in','($carat)'), 
array('stone_product/clarity','in','(7)'))))
 }

so that the value is $carat is populated correctly?

Thanks, Steve.

http://www.oneworldmarket.co.uk