steve walker
|
Friday 03 September 2004 9:19:24 am
Paul and Hans, Got it working exactly as I hoped for. The basic code with text form boxes is:
{let carat=ezhttp( 'search_carat', 'get' )}
{let clarity=ezhttp( 'search_clarity', 'get' )}
{let carat_in='('|concat($carat,')')
let clarity_in='('|concat($clarity,')')
let page_limit=3
let exactresults=fetch(content,tree,hash(parent_node_id, 59, limit, $page_limit,
attribute_filter,
array(and,array('stone_product/carat','in',$carat_in),
array('stone_product/clarity','in',$clarity_in))))
let fcarat_in='%'|concat($carat,'%')
let fclarity_in='%'|concat($clarity,'%')
let exactmatches=count($exactresults)
let fuzzyresults=fetch(content,tree,hash(parent_node_id, 59, limit, sub($page_limit,$exactmatches),
attribute_filter,
array(and,array('stone_product/fcarat','like',$fcarat_in),
array('stone_product/fclarity','like',$fclarity_in))))
}
<form action="{"/gia_certificated_diamonds"|ezurl}" method="get">
<div class="maincontentheader">
<h1>Stone Search</h1>
</div>
<div class="block">
<label>{"Carat"|i18n("design/standard/content/search")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="search_carat" value="{$carat|wash}" />
</div>
<div class="block">
<label>{"Clarity"|i18n("design/standard/content/search")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="search_clarity" value="{$clarity|wash}" />
</div>
<div class="break"></div>
</div>
<div class="buttonblock'">
<input class="button" type="submit" name="SearchButton" value="{'Search'|i18n('design/standard/content/search')}" />
</div>
<h2>Display the Results</h2>
<br>
exact results:
{section var=exactresults loop=$exactresults sequence=array(bglight,bgdark)}
{node_view_gui view=line content_node=$exactresults.item}<br>
{/section}
<br>
fuzzy results:
{section var=fuzzyresults loop=$fuzzyresults sequence=array(bglight,bgdark)}
{node_view_gui view=line content_node=$fuzzyresults.item}<br>
{/section}
</form>
{/let}
{/let}
{/let}
I've now got to add more fields and change them to dropdown lists, but the guts is well and truly there. Many thanks for your help. Regards Steve.
http://www.oneworldmarket.co.uk
|
steve walker
|
Tuesday 07 September 2004 1:26:50 am
Hi there, Have realised there is one issue stopping this working as it should - I think (hope) its only a minor tweak. The problem is that the fuzzy values should always have the non-fuzzy values in their array as well. To try to explain, if I have:
colour = G fuzzy colours = F H
size = 4 fuzzy size = 3 5 The fuzzy fetch needs to be able to look for the colour 'G' as well as size '3' or '5'. In the current code the fuzzy fetch only looks at stones that have values totally different (but one step away) - to cure this the fuzzy values would need to have the exact ones in there, so the example would change to:
colour = G fuzzy colours = F G H
size = 4 fuzzy size = 3 4 5 The problem now is duplicates found in the two fetches. Is it possible to take two fetches and make a comparison such that the second fetch removes any duplicates which it finds through checking the first fetch? Many thanks, Steve.
http://www.oneworldmarket.co.uk
|