ObjectRelationList with fetch function

Author Message

Lars Eirik R

Monday 26 July 2010 6:11:29 am

Hi.

I have encountered a problem of mine with regards to the fetch function for object relations.

I have two languages : norwegian and english.

I have one attribute called people which is a objectrelationlist.

I have 4 objects currently stored in the people attribute for tthe norwegian translation of the object, and only two people in the english list.

The problem is that the english page displays all 4 people as long as they do exist as translated objects in the system.

The goal is for me to be able to say to the editor that each country should be free to display its own preferred listing of people.

Surely this must be possible?

Thiago Campos Viana

Monday 26 July 2010 3:38:23 pm

Hi

You have to change [RegionalSettings] in settings/siteaccess/(nor|eng|othersiteaccess)/site.ini.append.php

You may have something like:

[RegionalSettings]
Locale=eng-GB
ContentObjectLocale=eng-GB
ShowUntranslatedObjects=enabled
SiteLanguageList[]

SiteLanguageList[]=eng-GB
SiteLanguageList[]=por-BR
TextTranslation=enabled

You may change these settings to something like:

[RegionalSettings]
Locale=eng-GB
ContentObjectLocale=eng-GB
ShowUntranslatedObjects=disabled
SiteLanguageList[]

SiteLanguageList[]=eng-GB
TextTranslation=enabled

For each siteaccess, according to your needs.

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Lars Eirik R

Monday 26 July 2010 10:21:27 pm

Thanks for the reply Thiago..

I already have the setting you suggest however.

in my template i do the following: {def $relatedobjects=fetch('content', 'related_objects', hash('object_id',$node.contentobject_id, 'attribute_identifier','frontpage/people' ) )}

when i loop through the $relatedobjects it seems that the list is filled with all results from both the norwegian and the english edit of the object.

Basically i have added 5 people objects to my people list when i edit in norwegian.

person a=john (exists in english and norwegian)

person b=mary(exists in english and norwegian)

person c=kate(exists in english and norwegian)

person d=bob(exists in english and norwegian)

person e=peter(exists only in norwegian)

For my english version i only want three of these people to be displayed.

english version of the people attribute list is populated with person a and person b and person e.

I would like to only have John,Mary and Peter displayed on my english siteaccess.

The results however is all people that do exist in one of the versions of the attribute people. (either english or norwegian)

Note that this only happens if the 5 people objects in the norwegian version of the attribute have been translated to english, therefore it appears that peter does not show up in the english list.

Could anyone please reproduce this on their installation with similar ways of relating content?

Thiago Campos Viana

Tuesday 27 July 2010 5:09:18 am

So, it could be a bug as related in http://issues.ez.no/IssueView.php?Id=17038&ProjectId=3

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Lars Eirik R

Tuesday 27 July 2010 6:15:41 am

this does not have to to with edit of the list , it has to do with the objects returned from the fetch as far as i understand..

thanks.

Lars Eirik R

Wednesday 28 July 2010 3:28:18 am

anybody else that can help out with this issue? Can i use the object relation list as i want to, or is this not supported?

Lars Eirik R

Wednesday 28 July 2010 4:27:25 am

to me it looks like the fetch function is not working as i hope. After having dealt with this , i realize that the only way to fetch correct values is to investigate the node object like this: $node.data_map.peoplelist.content.relation_list.

This gives me a reference to arrays which contains the actual ids for my current language.

Using these objectids i may use the following for each of the ids in the array..

fetch( 'content', 'object', hash( 'object_id', object_id )

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 30 2025 22:27:27
Script start
Timing: Jan 30 2025 22:27:27
Module start 'layout'
Timing: Jan 30 2025 22:27:27
Module start 'content'
Timing: Jan 30 2025 22:27:27
Module end 'content'
Timing: Jan 30 2025 22:27:27
Script end

Main resources:

Total runtime0.0258 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0040 588.2500151.2266
Module start 'layout' 0.00400.0044 739.4766220.7031
Module start 'content' 0.00840.0159 960.17971,006.4141
Module end 'content' 0.02430.0014 1,966.593841.9922
Script end 0.0257  2,008.5859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002710.5895140.0002
Check MTime0.00114.1425140.0001
Mysql Total
Database connection0.00062.147210.0006
Mysqli_queries0.00239.076430.0008
Looping result0.00000.077710.0000
Template Total0.00103.910.0010
Template load0.00083.069910.0008
Template processing0.00020.849610.0002
Override
Cache load0.00062.267510.0006
General
dbfile0.00114.241680.0001
String conversion0.00000.031540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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