Forums / Developer / ObjectRelationList with fetch function

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 )