Forums / Setup & design / ezselection datatype and custom search engine

ezselection datatype and custom search engine

Author Message

laurent le cadet

Monday 18 September 2006 8:31:57 am

Hi,

I builded a class with an ezselection datatype.
This a single choice selection made of 33 possibilities.

I would like to build a custom search template based on this attribute.
This would be a select which values are dynamicaly build with a loop on the selected items of the objects.
The list of values should be "wash" from redundant item...

I could hard coded it but I want to avoid the "no match" answer.

Any hint ?

Laurent

Claudia Kosny

Tuesday 19 September 2006 10:49:19 am

Hello Laurent

I am not sure whether I understand you right so here a example setup of what I think you want to do:
You have a class with an ezselection attribute which has 33 options.
Now you might have a few objects where option1 is selected, a few where option2 is selected and none where option3 is selected. You want to display a selectbox where only those options are available that are selected in some objects, in this case the options 1 and 2 but not 3.

As far as I know the only way to achieve this is to query for each option whether there is at least one object where this is selected. As these are quite a lot of queries you should cache this block so it gets only updated if really necessary.

If you find an easier way please post it as I am currently using this approach to display product categories and I do not like it to much.

Greetings from Luxembourg

Claudia

laurent le cadet

Wednesday 20 September 2006 1:26:35 am

Hi Claudia,

That's exactly what I need.

Please, let me know how is your query for option of each objetcs.

At this time, I have no other idea.

Laurent

Claudia Kosny

Wednesday 20 September 2006 1:29:06 pm

Hello Laurent

As you selection is fortunately a single selection such a query is fairly easy. So alltogether I would create such a selectbox like this:
- Fetch the class attribute for this object attribute to get an array with the ids and the corresponding clear names of all options.
- Go through each item in this array and make a simple fetch to check whether there is at least one object where the current option is selected. Something like this:

{set $testNodesArr = fetch('content', 'tree', hash ('parent_node_id', 2,
                                                                'limit', 1,
                                                                'attribute_filter', array( array( '<your_class>/<your-selection_attribute_identifier>', '=', <id of current option>))))}

If possible, it might be a good idea to use a better parent node and use list instead of tree. Also an limitation to the class type might be good, I was just to lazy to look up the proper syntax.
If $testNodesArr exists and has at least one item, there is a object where the current option is selected so add this option to the selectbox.

As you can see this is something which should be well cached.

Greetings from Luxembourg

Claudia

eZ debug

Timing: Jan 18 2025 16:27:01
Script start
Timing: Jan 18 2025 16:27:01
Module start 'content'
Timing: Jan 18 2025 16:27:02
Module end 'content'
Timing: Jan 18 2025 16:27:02
Script end

Main resources:

Total runtime0.9712 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 587.8438180.8125
Module start 'content' 0.00660.7421 768.6563530.0078
Module end 'content' 0.74870.2224 1,298.6641336.7422
Script end 0.9712  1,635.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4029210.0002
Check MTime0.00140.1451210.0001
Mysql Total
Database connection0.00080.078710.0008
Mysqli_queries0.895392.18621970.0045
Looping result0.00230.23891950.0000
Template Total0.941496.920.4707
Template load0.00190.192720.0009
Template processing0.939596.732020.4697
Template load and register function0.00010.009010.0001
states
state_id_array0.00100.101710.0010
state_identifier_array0.00130.134820.0007
Override
Cache load0.00160.1658400.0000
Sytem overhead
Fetch class attribute can translate value0.00100.104330.0003
Fetch class attribute name0.00150.159650.0003
XML
Image XML parsing0.00070.069530.0002
class_abstraction
Instantiating content class attribute0.00000.001360.0000
General
dbfile0.00270.2813270.0001
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs