category - subcategory problem

Author Message

Alessandro Cipriani

Monday 19 April 2004 2:23:03 am

hi all
i've this problem:
the user of my site will be categorized with two parameters, the second linked to the first in this way (either are select attribute):
cat1
-subcat11
-subcat21
-subcat31
cat2
-subcat21
-subcat22

and so on

in such an organization i'd like to avoid any error (like to have a customer of category 1 and subcategory 21) during the user registration.
the simplest way i thought was to write a javascript that loads only the appropriate values on the 2nd select one a choice on the first one is made. but i've problem with javascript function and i don't know if it's the right choice.

is there some built in mechanism to solve this problem?

best regards
alessandro

Gunnstein Lye

Monday 19 April 2004 7:24:45 am

If I understand you correctly, you don't need to store the first parameter. If you have stored subcat21, then you know that the first parameter must be cat2. No need to store both.

Alessandro Cipriani

Tuesday 20 April 2004 12:14:56 am

hi Gunnstein,
yes, i could do it,
but our customer asked two combos exactly in the way i explained in my first post.
so, before call him to tell that it's not possible, i wonder if there is a way to do what he wants.
also i tried to insert some javascript code inside the register.tpl file but, as any attribute is loaded programmatically, i'll have to change the entire code of the file.

is there any alternative way?
best regards
alessandro

Gunnstein Lye

Tuesday 20 April 2004 12:40:48 am

You can of course have two combo boxes, but you only need to store the second one. You can use the first one only to choose the right content for the second one (with javascript).

I suggest you use alternative attribute views, for instance:

(in register.tpl)
{attribute_edit_gui view="myspecialjavascript" attribute=$myattributelist.myattribute}

Now, create your special attribute in mydesign/content/datatype/edit/myspecialjavascript/ezselection.tpl
(if your attribute is an ezselection, of course.)

This way you don't have to have the same template for all attributes of the same type.

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 19 2025 15:13:10
Script start
Timing: Jan 19 2025 15:13:10
Module start 'layout'
Timing: Jan 19 2025 15:13:10
Module start 'content'
Timing: Jan 19 2025 15:13:11
Module end 'content'
Timing: Jan 19 2025 15:13:11
Script end

Main resources:

Total runtime0.8660 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 590.5859152.6250
Module start 'layout' 0.00490.0029 743.210939.4453
Module start 'content' 0.00780.8569 782.6563532.1484
Module end 'content' 0.86470.0013 1,314.804712.1641
Script end 0.8660  1,326.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3505160.0002
Check MTime0.00130.1485160.0001
Mysql Total
Database connection0.00050.056610.0005
Mysqli_queries0.812993.8662600.0135
Looping result0.00040.0495580.0000
Template Total0.840697.120.4203
Template load0.00220.252820.0011
Template processing0.838496.808520.4192
Template load and register function0.00010.015310.0001
states
state_id_array0.00070.083710.0007
state_identifier_array0.00060.071020.0003
Override
Cache load0.00180.2043420.0000
Sytem overhead
Fetch class attribute can translate value0.00110.122820.0005
Fetch class attribute name0.00080.089160.0001
XML
Image XML parsing0.00320.367520.0016
class_abstraction
Instantiating content class attribute0.00000.001480.0000
General
dbfile0.00310.3539220.0001
String conversion0.00000.001340.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
4content/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
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs