Bug #89498
openFSC menu_categorized_content doesn't return content of non default language
0%
Description
Envireonment:
A site with multible languages and categorised content elements.
On a overview page we use the fsc ctype menu_categorized_content to display all ces related to a branch (category).
On the page with the default language menu_categorized_content returns all ces related to the category. Perfect!
On the translated page menu_categorized_content doesn't return any ce.
After checking the sql query there are two problems.
Query in default language:
SELECT tt_content.* FROM `tt_content` INNER JOIN `sys_category_record_mm` ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(18) WHERE (`tt_content`.`pid` IN (1, 2, 3, 4, 5, 6, 7, 8, 9)) AND (tablenames='tt_content' and fieldname='categories') AND (`tt_content`.`sys_language_uid` IN (0, -1)) AND ((`tt_content`.`deleted` = 0) AND (`tt_content`.`t3ver_state` <= 0) AND (`tt_content`.`pid` <> -1) AND (`tt_content`.`hidden` = 0) AND (`tt_content`.`starttime` <= 1571910180) AND ((`tt_content`.`endtime` = 0) OR (`tt_content`.`endtime` > 1571910180)) AND (((`tt_content`.`fe_group` = '') OR (`tt_content`.`fe_group` IS NULL) OR (`tt_content`.`fe_group` = '0') OR (FIND_IN_SET('0', `tt_content`.`fe_group`)) OR (FIND_IN_SET('-2', `tt_content`.`fe_group`)) OR (FIND_IN_SET('13', `tt_content`.`fe_group`))))) GROUP BY `uid` ORDER BY `tt_content`.`header` ASC
Query in lang 1:
SELECT tt_content.* FROM `tt_content` INNER JOIN `sys_category_record_mm` ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(18) WHERE (`tt_content`.`pid` IN (1, 2, 3, 4, 5, 6, 7, 8, 9)) AND (tablenames='tt_content' and fieldname='0') AND (`tt_content`.`sys_language_uid` IN (0, -1)) AND ((`tt_content`.`deleted` = 0) AND (`tt_content`.`t3ver_state` <= 0) AND (`tt_content`.`pid` <> -1) AND (`tt_content`.`hidden` = 0) AND (`tt_content`.`starttime` <= 1571909640) AND ((`tt_content`.`endtime` = 0) OR (`tt_content`.`endtime` > 1571909640)) AND (((`tt_content`.`fe_group` = '') OR (`tt_content`.`fe_group` IS NULL) OR (`tt_content`.`fe_group` = '0') OR (FIND_IN_SET('0', `tt_content`.`fe_group`)) OR (FIND_IN_SET('-2', `tt_content`.`fe_group`)) OR (FIND_IN_SET('13', `tt_content`.`fe_group`))))) GROUP BY `uid` ORDER BY `tt_content`.`header` ASC
Problems in the query:
1:
(tablenames='tt_content' and fieldname='0')
Seems like "data = field:category_field" returns 0 in non default lannguage.
https://github.com/TYPO3/TYPO3.CMS/blob/v8.7.28/typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuCategorizedContent.txt#L19
2:
(`tt_content`.`sys_language_uid` IN (0, -1)
It just queries default and all language records instead of the current language.
The first I have workedaround with fixing the fieldname
tt_content.menu_categorized_content.dataProcessing.10.where >
tt_content.menu_categorized_content.dataProcessing.10.where = {#tablenames}='tt_content' and {#fieldname}='categories'
For problem 2 I haven't a workaround yet.
Updated by Jan Kiesewetter about 5 years ago
Here is a workaround that works completely:
tt_content {
menu_categorized_content {
dataProcessing {
10 {
# Disable default language handling because it would return "0, -1" even in non default language
languageField = 0
where >
where.data = field:sys_language_uid
where.intval = 1
# Build own language handling by using using sys_language_uid of the current ce
where.wrap = {#tt_content.sys_language_uid} IN (|, -1) AND {#tablenames}='tt_content' AND {#fieldname}='categories'
}
}
}
}
This is just a workaround! I think at least the field:category_field function must be fixed to return the right field in non default languages.
I think the language probleme occurs because the selected category in the menu_categorized_content ce has always 0 as sys_language_uid because the category tree shows only default language categories.
Updated by Jan Kiesewetter about 5 years ago
Seems like
config.sys_language_overlay = 1
is responsible for the language problem.
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Setup/Config/Index.html#sys-language-overlay
Query with
L=1
and
config.sys_language_overlay = 1
config.sys_language_mode = content_fallback;0
SELECT tt_content.* FROM `tt_content` INNER JOIN `sys_category_record_mm` ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(18) WHERE (`tt_content`.`pid` IN (1, 2, 3, 4, 5, 6, 7, 8, 9)) AND (tablenames='tt_content' and fieldname='0') AND (`tt_content`.`sys_language_uid` IN (0, -1)) AND ((`tt_content`.`deleted` = 0) AND (`tt_content`.`t3ver_state` <= 0) AND (`tt_content`.`pid` <> -1) AND (`tt_content`.`hidden` = 0) AND (`tt_content`.`starttime` <= 1571922660) AND ((`tt_content`.`endtime` = 0) OR (`tt_content`.`endtime` > 1571922660)) AND (((`tt_content`.`fe_group` = '') OR (`tt_content`.`fe_group` IS NULL) OR (`tt_content`.`fe_group` = '0') OR (FIND_IN_SET('0', `tt_content`.`fe_group`)) OR (FIND_IN_SET('-2', `tt_content`.`fe_group`)) OR (FIND_IN_SET('13', `tt_content`.`fe_group`))))) GROUP BY `uid`
L=1
and
config.sys_language_overlay >
config.sys_language_mode = content_fallback;0
SELECT tt_content.* FROM `tt_content` INNER JOIN `sys_category_record_mm` ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(18) WHERE (`tt_content`.`pid` IN (1, 2, 3, 4, 5, 6, 7, 8, 9)) AND (tablenames='tt_content' and fieldname='0') AND (`tt_content`.`sys_language_uid` = 1) AND ((`tt_content`.`deleted` = 0) AND (`tt_content`.`t3ver_state` <= 0) AND (`tt_content`.`pid` <> -1) AND (`tt_content`.`hidden` = 0) AND (`tt_content`.`starttime` <= 1571922420) AND ((`tt_content`.`endtime` = 0) OR (`tt_content`.`endtime` > 1571922420)) AND (((`tt_content`.`fe_group` = '') OR (`tt_content`.`fe_group` IS NULL) OR (`tt_content`.`fe_group` = '0') OR (FIND_IN_SET('0', `tt_content`.`fe_group`)) OR (FIND_IN_SET('-2', `tt_content`.`fe_group`)) OR (FIND_IN_SET('13', `tt_content`.`fe_group`))))) GROUP BY `uid`
So the language problem is no problem because the IN (0, -1) is correct for to config.sys_language_overlay = 1. And the translation will happen in the next query.
In config.sys_language_overlay = 0 it's (`tt_content`.`sys_language_uid` = 1)
So the workaround would be for both overlay modes.
tt_content {
menu_categorized_content {
dataProcessing {
10 {
where.data >
where = categories
}
}
}
}
So problem is field:category_field returns 0 in none default language.
Updated by Jo Hasenau over 1 year ago
- Related to Story #101565: Frontend related translation issues added