Please help the Newbie...

Author Message

Koos TDK

Monday 13 September 2004 7:27:54 am

Hi I have searched the forums but I'm still not sure how to do this. I am sure it must be very easy. Any help from the guru's on the forum will be much appreciated!

OK, <b>Step1:</b> On my site, I want people to be able to search for companies or products. This is easy as per the docs(restricting a search by class):

<form action="/content/advancedsearch/" method="get">
<input class="searchbox" type="text" size="8" name="SearchText" id="Search" value="" />
<input class="searchbutton" name="SearchButton" type="submit" value="Search" />
<input type="hidden" name="SearchContentClassID" value="14" />
</form>

Now, my problem <b>Step 2:</b> I want the person doing the search, to only see results for a specific REGION/COUNTY/STATE(whatever you wish to call it :-)) which is available via a drop-down list.

Thus, he/she can search for "Oranges" in "Ohio" and he/she will only see anything related to Oranges in Ohia and no other state.

I have created a custom "CP_Company" class with "Region" being a "Selection" attribute. How would I allow a search in all other attributes of this class, BUT only results with the selected "Region" attribute value will be displayed?

Thanks for any help!!! :-)

Lazaro Ferreira

Monday 13 September 2004 11:27:05 am

Hi,

You will have to create a custom search page, using the search operator

Look at this URL
http://ez.no/ez_publish/documentation/reference/data_fetching/content/search

Lazaro

Lazaro
http://www.mzbusiness.com

Koos TDK

Tuesday 14 September 2004 12:28:23 am

Hi Lazaro

Thanks for your help. I have had a look at the search operator, but I have been lost(or just too stupid!) in figuring out how to get the search done since it seems to be a "dual" search solution, i.e. 1.) I will get the text the person want to search for from a text box on the website(say it is "orange" for argument's sake), then 2.) he/she selects a geographical region from a drop-down list for which to filter(say "ohio" for argument's sake).(The value will be available from what the person has selected in the drop-down list).

<b>Thus EZP must be able to search:</b>
1.) For the text "orange" only in my custom content class(id=32)
2.) But only return results where "ohio" matches the text in the "region" attribute(id=245) of content class 32, which is of datatype "selection". I have added the possible options that can be selected as elements of the "selection" datatype, so those values are static.

THANKS!! :-)

Koos TDK

Tuesday 14 September 2004 7:35:12 am

OK, have done some testing, but so far a bit disappointing.

The following code in pagelayout.tpl allows the user to enter text to search for in a form. This search is only done against the "Region" attribute of the class.

This is the second part of the solution to my problem. But how do I do the MAIN search in the rest of the attributes with this solutions as the "filter" or "constraint"?? A looped search? Is there an easier way or am I missing somethin?

<form action={"/content/advancedsearch/"|ezurl} method="get"> 
<input class="searchbox" type="text" size="8" name="SearchText" id="Search" value="" />
<input class="searchbutton" name="SearchButton" type="submit" value="Search" />
<input type="hidden" name="SearchContentClassID" value="32" />
<input type="hidden" name="SearchContentClassAttributeID" value="245" />
</form> 

Thanks!

Koos TDK

Wednesday 15 September 2004 4:53:27 am

Hi!

Using version 3.4.1

It seems like the code below should give me the required results(According to all my research on the forums). But it does not return ANY results and there are no debugging errors being returned! (Yes, there is a single item that matches an "and" on those attributes and values).

<b>I have this code in my "pagelayout.tpl" file -- should it maybe be somewhere else? Could this be the problem?</b>

{section loop=fetch(content,tree,hash(parent_node_id, 105, attribute_filter,
 array(and,array(240,'like','%orange%'), array(245,'like','%ohio%'))))
}
{$:item.name}
{/section}

Any help will be much appreciated!

Paul Borgermans

Wednesday 15 September 2004 5:09:47 am

Did you use the patched ezcontentobjecttreenode.php file from teh contributions? the 'like' operator is not supported by default.

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Koos TDK

Thursday 16 September 2004 7:27:40 am

Hi Paul

Thanks for the reply. Yes, I have copied the new ezcontentobjecttreenode.php to "/kernel/classes".

I have tested only filtering on a single attribute and it works 100%, like so:

{section loop=fetch(content,list,hash(parent_node_id, 105, attribute_filter,
 array(and,array(240,'like','%orange%'))))
}

This then returns only entries with "orange" in attribute 240.(But only the value of the first attribute in the object).

BUT there is a problem when trying to filter on a second attribute, it does not return any results! Even when specifying to search for "%" in the firts attribute and "%n%" in the other, it returns nothing, the code:

{section loop=fetch(content,list,hash(parent_node_id, 105, attribute_filter, 
array(and, array(240,'like','%'), array(245,'like','%n%'))))
}

Also, the fetch only returns the value of the very first attribute of the object, I have tried changing the "list" to "tree" but I don't see any difference in the results.

This is driving me mad, so close, but it just doesn't want to work!!

ANY help greatly appreciated(again!) :-)

Andrew Vorobyov

Sunday 29 May 2005 12:42:29 am

Koos is not alone!

please help folks...

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:23:18
Script start
Timing: Jan 18 2025 22:23:18
Module start 'layout'
Timing: Jan 18 2025 22:23:18
Module start 'content'
Timing: Jan 18 2025 22:23:19
Module end 'content'
Timing: Jan 18 2025 22:23:19
Script end

Main resources:

Total runtime0.9610 sec
Peak memory usage4,096.0000 KB
Database Queries76

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0084 589.3359152.6250
Module start 'layout' 0.00840.0041 741.960939.4297
Module start 'content' 0.01250.9471 781.3906683.5703
Module end 'content' 0.95950.0014 1,464.960920.1797
Script end 0.9610  1,485.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3573160.0002
Check MTime0.00140.1476160.0001
Mysql Total
Database connection0.00130.131210.0013
Mysqli_queries0.847888.2159760.0112
Looping result0.00090.0917740.0000
Template Total0.917795.520.4588
Template load0.00270.282720.0014
Template processing0.915095.206720.4575
Template load and register function0.00020.019010.0002
states
state_id_array0.00200.204810.0020
state_identifier_array0.00110.110920.0005
Override
Cache load0.00210.2196600.0000
Sytem overhead
Fetch class attribute can translate value0.00100.108640.0003
Fetch class attribute name0.00150.1575100.0002
XML
Image XML parsing0.00270.281640.0007
class_abstraction
Instantiating content class attribute0.00000.0034140.0000
General
dbfile0.00120.1213230.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 38
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs