Forums / Developer / Search on ezselection and ezrelatedobject

Search on ezselection and ezrelatedobject

Author Message

Andrew Vorobyov

Thursday 02 June 2005 11:45:40 am

Hello, please explain to the idiot..

I have object with 4 ezselection attr and 3 object relation attr.

<b>How can I carry out search by these fields?</b>

					attribute_filter, array(
  array('object/ezselection_attr_country','=','USA')
 )
)

It's NOT working!!!
I spent whole day digging this - no results...
I'm in despair and thinking about suicide!!

Help me pls...

Andrew Vorobyov

Thursday 02 June 2005 10:01:58 pm

I did it...

You should source $node.contentobject_id of your relation objects...

Xavier Dutoit

Friday 03 June 2005 9:38:47 am

Hi Andrew,

Glad to know you've found and that you haven't commited suicide ;)

Anyway, could you post the template code you've written to solve your problem, as it might help others too ?

X+

http://www.sydesy.com

Andrew Vorobyov

Wednesday 08 June 2005 12:23:09 pm

Maybe it will help to somebody...

There are <b>ezselection</b> and <b>ezrelation</b> attributes in this search.

This is the search form:

<form action={"/content/advancedsearch/my"|ezurl} method="post">
  <div whitespace=nowrap>


   <input id="searchbutton" class="button" name="SearchButton" type="submit" value="Search" />
   <input type="hidden" name="Content_search_attribute_fulltext_classattribute_id[]" value="224" />
    By country: <select name="Content_search_attribute_fulltext_value[]">
		{let attr1=fetch( 'content', 'class_attribute', hash( 'attribute_id', 224) )}
		
		{section var = country loop = fetch('content','list',hash(
							'parent_node_id',$attr1.content.default_selection_node
							))
		}
		 <option value="{$country.name|wash}">{$country.name|wash}</option>
		 {/section}
		{/let}
              </select>

   <input type="hidden" name="Content_search_attribute_fulltext_classattribute_id[]" value="228" />
    By city: 
	<select name="Content_search_attribute_fulltext_value[]">
		{let attr2=fetch( 'content', 'class_attribute', hash( 'attribute_id', 228) )}
		{section var = city loop = fetch('content','list',hash(
							'parent_node_id',$attr2.content.default_selection_node
							))
		}
		<option value="{$city.name|wash}">{$city.name|wash}</option>			
		{/section}
		{/let}
	</select>

   </div>
  <input type="hidden" name="SubTreeArray" value="95"  />
  <input type="hidden" name="SearchContentClassID" value="25"  / >
</form>

<table border=0 width="100%">
<tr>
{section loop = fetch('content','list',hash(
						'parent_node_id',$node.node_id
					)
		)
}		<td>
		<a href={$:item.url_alias|ezurl}>{$:item.name}</a> - age {$:item.data_map.age.value}<br>
		{attribute_view_gui attribute=$:item.data_map.photo image_class='small'}
		</td>
	{delimiter modulo=3}
		  </tr>
		  <tr>
	{/delimiter}
{/section}
</tr>
</table>

Here goes processing:

{def $params = hash(
		'offset', cond(ezhttp( 'offset','post' ),ezhttp( 'offset','post' ),true(),0)|int,
		'limit', cond(ezhttp( 'limit','post' ),ezhttp( 'limit','post' ),true(),2)|int,
		'agefrom', ezhttp( 'agefrom','post' ),
		'ageto', ezhttp( 'ageto','post' ),
		'heightfrom', ezhttp( 'heightfrom','post' ),
		'heightto', ezhttp( 'heightto','post' ),
		'weightfrom', ezhttp( 'weightfrom','post' ),
		'weightto', ezhttp( 'weightto','post' ),
		'eyes', ezhttp( 'eyes','post' ),
		'hair', ezhttp( 'hair','post' ),
		'marital', ezhttp( 'marital','post' ),
		'children', ezhttp( 'children','post' ),
		'english', ezhttp( 'english','post' ),
		'language', ezhttp( 'language','post' ),
		'religion', ezhttp( 'religion','post' ),
		'country', ezhttp( 'country','post' ),
		'city', ezhttp( 'city','post' )
		)
} 

{*$params|attribute(show,2)*}
{def $search_params = array()}

{if $params.agefrom|ne('')}
{def $search_params = $search_params|append(array('woman/age','>=',$params.agefrom))}
{/if}

{if $params.ageto|ne('')}
{def $search_params = $search_params|append(array('woman/age','<=',$params.ageto))}
{/if}

{if $params.heightfrom|ne('')}
{def $search_params = $search_params|append(array('woman/height','>=',$params.heightfrom))}
{/if}

{if $params.heightto|ne('')}
{def $search_params = $search_params|append(array('woman/height','<=',$params.heightto))}
{/if}

{if $params.weightfrom|ne('')}
{def $search_params = $search_params|append(array('woman/weight','>=',$params.weightfrom))}
{/if}

{if $params.weightto|ne('')}
{def $search_params = $search_params|append(array('woman/weight','<=',$params.weightto))}
{/if}

{if $params.eyes|ne('')}
{def $search_params = $search_params|append(array('woman/eyes','=',$params.eyes))}
{/if}

{if $params.hair|ne('')}
{def $search_params = $search_params|append(array('woman/hair','=',$params.hair))}
{/if}

{if $params.marital|ne('')}
{def $search_params = $search_params|append(array('woman/marital','=',$params.marital))}
{/if}

{if $params.children|ne('')}
{def $search_params = $search_params|append(array('woman/children','=',$params.children))}
{/if}

{if $params.religion|ne('')}
{def $search_params = $search_params|append(array('woman/religion','=',$params.religion))}
{/if}

{if $params.english|ne('')}
{def $search_params = $search_params|append(array('woman/english','>=',$params.english))}
{/if}

{if $params.country|ne('')}
{def $search_params = $search_params|append(array('woman/country','=',$params.country|int))}
{/if}

{if $params.city|ne('')}
{def $search_params = $search_params|append(array('woman/city','=',$params.city|int))}
{/if}

{* $search_params|attribute(show,2) *}

{def $women = fetch( 'content','tree',
       hash( parent_node_id, 114,
		offset,$params.offset,
		limit,$params.limit,
		class_filter_type, include,
		class_filter_array, array('woman'),
		attribute_filter, $search_params
	)
	)

$total = fetch( 'content','tree_count',
       hash( parent_node_id, 114,
		class_filter_type, include,
		class_filter_array, array('woman'),
		attribute_filter, $search_params
	)
	)

}

{section show=$total|gt($limit)}
Total women found: <b>{$total}</b><br>

<TABLE border="0" cellspacing=5>
<TR>
{section var=woman loop=$women}
{node_view_gui content_node=$woman view='line'}
{/section}
</TR>
</TABLE>

{def $total_pages = $total|div($params.limit|int)|ceil}
<TABLE border="0" cellspacing=5>
<TR>
<TD>
<form action={"/content/advancedsearch/searchforwoman"|ezurl} method="post">
	<input type="hidden" name="offset" value="0"/>
	<input type="hidden" name="limit" value="{$params.limit}"/>
	<input type="hidden" name="agefrom" value="{$params.agefrom}"/>
	<input type="hidden" name="ageto" value="{$params.ageto}"/>
	<input type="hidden" name="heightfrom" value="{$params.heightfrom}"/>
	<input type="hidden" name="heightto" value="{$params.heightto}"/>
	<input type="hidden" name="eyes" value="{$params.eyes}"/>
	<input type="hidden" name="hair" value="{$params.hair}"/>
	<input type="hidden" name="marital" value="{$params.marital}"/>
	<input type="hidden" name="children" value="{$params.children}"/>
	<input type="hidden" name="language" value="{$params.language}"/>
	<input type="hidden" name="english" value="{$params.english}"/>
	<input type="hidden" name="religion" value="{$params.religion}"/>
	<input type="hidden" name="country" value="{$params.country}"/>
	<input type="hidden" name="city" value="{$params.city}"/>
	<input class="searchbutton" name="SearchButton" type="submit" value="|<"}"/>
</form>
</TD>
{for 0 to $total_pages|sub(1) as $i}
<TD>
<form action={"/content/advancedsearch/searchforwoman"|ezurl} method="post">
	<input type="hidden" name="offset" value="{mul($i,$params.limit)}"/>
	<input type="hidden" name="limit" value="{$params.limit}"/>
	<input type="hidden" name="agefrom" value="{$params.agefrom}"/>
	<input type="hidden" name="ageto" value="{$params.ageto}"/>
	<input type="hidden" name="heightfrom" value="{$params.heightfrom}"/>
	<input type="hidden" name="heightto" value="{$params.heightto}"/>
	<input type="hidden" name="eyes" value="{$params.eyes}"/>
	<input type="hidden" name="hair" value="{$params.hair}"/>
	<input type="hidden" name="marital" value="{$params.marital}"/>
	<input type="hidden" name="children" value="{$params.children}"/>
	<input type="hidden" name="language" value="{$params.language}"/>
	<input type="hidden" name="english" value="{$params.english}"/>
	<input type="hidden" name="religion" value="{$params.religion}"/>
	<input type="hidden" name="country" value="{$params.country}"/>
	<input type="hidden" name="city" value="{$params.city}"/>
	<input class="searchbutton" name="SearchButton" type="submit" value="{$i|inc}"/>
</form>
</TD>
{/for}
<TD>
<form action={"/content/advancedsearch/searchforwoman"|ezurl} method="post">
	<input type="hidden" name="offset" value="{mul($total_pages|sub(1),$params.limit)}"/>
	<input type="hidden" name="limit" value="{$params.limit}"/>
	<input type="hidden" name="agefrom" value="{$params.agefrom}"/>
	<input type="hidden" name="ageto" value="{$params.ageto}"/>
	<input type="hidden" name="heightfrom" value="{$params.heightfrom}"/>
	<input type="hidden" name="heightto" value="{$params.heightto}"/>
	<input type="hidden" name="eyes" value="{$params.eyes}"/>
	<input type="hidden" name="hair" value="{$params.hair}"/>
	<input type="hidden" name="marital" value="{$params.marital}"/>
	<input type="hidden" name="children" value="{$params.children}"/>
	<input type="hidden" name="language" value="{$params.language}"/>
	<input type="hidden" name="english" value="{$params.english}"/>
	<input type="hidden" name="religion" value="{$params.religion}"/>
	<input type="hidden" name="country" value="{$params.country}"/>
	<input type="hidden" name="city" value="{$params.city}"/>
	<input class="searchbutton" name="SearchButton" type="submit" value=">|"}"/>
</form>
</TD>
</TR>
</TABLE>
{/section} 

eZ debug

Timing: Jan 31 2025 04:27:29
Script start
Timing: Jan 31 2025 04:27:29
Module start 'content'
Timing: Jan 31 2025 04:27:29
Module end 'content'
Timing: Jan 31 2025 04:27:29
Script end

Main resources:

Total runtime0.1382 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.0625180.8125
Module start 'content' 0.00530.0051 768.8750106.0547
Module end 'content' 0.01040.1278 874.9297534.6250
Script end 0.1381  1,409.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.4372200.0002
Check MTime0.00130.9331200.0001
Mysql Total
Database connection0.00060.431310.0006
Mysqli_queries0.097270.34581410.0007
Looping result0.00100.73901390.0000
Template Total0.127592.210.1275
Template load0.00080.549810.0008
Template processing0.126791.675010.1267
Override
Cache load0.00050.389310.0005
Sytem overhead
Fetch class attribute can translate value0.00050.330710.0005
XML
Image XML parsing0.00020.176610.0002
General
dbfile0.00533.8391200.0003
String conversion0.00000.003630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs