Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categories picker shows all categories, including translations #186

Open
fritzmg opened this issue Feb 26, 2021 · 7 comments
Open

Categories picker shows all categories, including translations #186

fritzmg opened this issue Feb 26, 2021 · 7 comments
Assignees
Labels

Comments

@fritzmg
Copy link
Contributor

fritzmg commented Feb 26, 2021

When having terminal42/dc_multilingual: 4.1.1 + codefog/contao-news_categories: 3.4.2 installed, the categories picker for a news entry shows all categories, including the translated versions, which are usually hidden. This does not happen with terminal42/dc_multilingual: 3.0.8 + codefog/contao-news_categories: 3.3.1.

Also the tab's label in the picker is not translated, it says newsCategoriesPicker.

@qzminski
Copy link
Member

I think we have to wait until this one is resolved – terminal42/contao-DC_Multilingual#70

@fritzmg
Copy link
Contributor Author

fritzmg commented Mar 30, 2021

Hm, is there a way to fix this temporarily somehow? Our customers are getting a bit confused by the current back end view.

@fritzmg
Copy link
Contributor Author

fritzmg commented Mar 31, 2021

Btw. I also noticed that using

NewsCategoryModel::findById(…)
NewsCategoryModel::findByIdOrAlias(…)

does not work if the given ID or alias is that of a translated category. It always returns null. Is this related to the same problem?

The executed query looks like this:

SELECT 
  IFNULL(translation.id, tl_news_category.id) AS id, 
  IFNULL(translation.language, tl_news_category.language) AS LANGUAGE, 
  IFNULL(translation.lid, tl_news_category.lid) AS lid, 
  tl_news_category.pid, 
  tl_news_category.sorting, 
  tl_news_category.tstamp, 
  tl_news_category.cssClass, 
  tl_news_category.image, 
  tl_news_category.hideInList, 
  tl_news_category.hideInReader, 
  tl_news_category.excludeInRelated, 
  tl_news_category.jumpTo, 
  tl_news_category.published, 
  IFNULL(translation.title, tl_news_category.title) AS title, 
  IFNULL(translation.frontendTitle, tl_news_category.frontendTitle) AS frontendTitle, 
  IFNULL(translation.alias, tl_news_category.alias) AS alias, 
  IFNULL(translation.description, tl_news_category.description) AS DESCRIPTION 
FROM tl_news_category tl_news_category 
LEFT OUTER JOIN tl_news_category translation ON tl_news_category.id=translation.lid 
  AND translation.language='de' 
WHERE (tl_news_category.lid=0) 
  AND (BINARY tl_news_category.alias='translated-alias') LIMIT 0,1

but this will always return no records.

@qzminski
Copy link
Member

qzminski commented Apr 8, 2021

@fritzmg honestly I am able to reproduce the issue only partially – inside the popup there are no translations displayed, but the news picker widget inside the news settings displays the translations of selected records instead of original values. Can you reach me on Slack and check this problem together on your system/database dump?

2021-04-08 at 19 48
2021-04-08 at 19 48

@qzminski
Copy link
Member

qzminski commented Apr 8, 2021

Btw. I also noticed that using … does not work if the given ID or alias is that of a translated category. It always returns null. Is this related to the same problem?

I believe this is a DC_Multilingual problem itself, as news categories don't override the findById and findByIdOrAlias methods. Perhaps you would like to use findPublishedByIdOrAlias method?

@fritzmg
Copy link
Contributor Author

fritzmg commented Apr 8, 2021

I see, hmm. It's a setup where terminal42/dc_multilingual was updated from 3 to 4. I suppose that could be the problem?

@qzminski
Copy link
Member

qzminski commented Apr 9, 2021

I think it can only if the database data structure is different (e.g., language columns contain different data than if created with v4). Can you send me a dump of your tl_news_category table please? Can be either via e-mail or Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants