Closed (duplicate)
Project:
Entity Translation
Version:
7.x-1.0-alpha2
Component:
Views integration
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jun 2012 at 12:07 UTC
Updated:
3 Apr 2013 at 16:28 UTC
If a Content Type is set up with a translatable field (eg. a replacement title), and a View is created to show nodes of that Type with either a Filter or Sort Criteria that uses the translatable field, the join clauses which produce the initial list of nodes do not filter by the current language. This produces a list of nodes where each is repeated as many times as there are translations for that field. (If more than one translatable field are used, each node is repeated for each combination of field translations -- which will probably be the number of languages used raised to the power of the number of filters/sorts.)
Example (from the Views Query preview):
SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language, field_data_field_name.field_name_value AS field_data_field_name_field_name_value
FROM
{node} node
LEFT JOIN {field_data_field_name} field_data_field_name ON node.nid = field_data_field_name.entity_id AND (field_data_field_name.entity_type = 'node' AND field_data_field_name.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN ('MyContentType')) ))
ORDER BY field_data_field_name_field_name_value ASCShould be more like:
SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language, field_data_field_name.field_name_value AS field_data_field_name_field_name_value
FROM
{node} node
LEFT JOIN {field_data_field_name} field_data_field_name ON node.nid = field_data_field_name.entity_id AND (field_data_field_name.entity_type = 'node' AND field_data_field_name.deleted = '0') AND field_data_field_name.language = '[current language]'
WHERE (( (node.status = '1') AND (node.type IN ('MyContentType')) ))
ORDER BY field_data_field_name_field_name_value ASC
Comments
Comment #1
plach#1330332: Entity translation: Views field language filter
Comment #2
anu17 commentedHi
Is there any solution to this problem because since two days i'm facing the same problem.
Actually my fields which are translatable appear multiple times in a view when i add filtering and sorting criteria to my view. Can you please suggest some solution for it.
I tried aggregation but there is some ajax error and view isn't allowing me to use aggregation.
Comment #3
plachSee #1330332-35: Entity translation: Views field language filter.