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

Fix filter language in category (issue reported here : https://github.com/joomla/joomla-cms/issues/5734) #5740

Closed
wants to merge 5 commits into from

Conversation

cyrezdev
Copy link
Contributor

Fix for issue reported here : #5734
Add check of parent category language

Steps to reproduce the issue

Assume you have a multilanguage site with Lang1 and Lang2 languages activated in frontend. You have 2 menus to show content in Lang1 and Lang2 languages: MenuLang1 and MenuLang2. Create new category CatLang1 in backend category manager and assign Lang1 to it. Create new article ArtLang2 in this category and assign Lang2 to it. Add menu item showing just added category blog to each of menus (MenuLang1 and MenuLang2).

Expected result
On frontend only MenuLang1 item should show CatLang1 category but MenuLang2 should filter it out. No articles should be shown in CatLang1 since ArtLang2 has wrong language.

Actual result
Both MenuLang1 and MenuLang2 shows CatLang1 category. CatLang1 in MenuLang2 shows ArtLang2. Category is not filtered by language.

Fix for issue reported here : joomla#5734
Add check of parent category language

<blockquote>
Steps to reproduce the issue

Assume you have a multilanguage site with Lang1 and Lang2 languages activated in frontend. You have 2 menus to show content in Lang1 and Lang2 languages: MenuLang1 and MenuLang2. Create new category CatLang1 in backend category manager and assign Lang1 to it. Create new article ArtLang2 in this category and assign Lang2 to it. Add menu item showing just added category blog to each of menus (MenuLang1 and MenuLang2).

<b>Expected result</b>
On frontend only MenuLang1 item should show CatLang1 category but MenuLang2 should filter it out. No articles should be shown in CatLang1 since ArtLang2 has wrong language.

<b>Actual result</b>
Both MenuLang1 and MenuLang2 shows CatLang1 category. CatLang1 in MenuLang2 shows ArtLang2. Category is not filtered by language.
</blockquote>
@cyrezdev cyrezdev changed the title Fix article language filter in category (issue reported here : https://github.com/joomla/joomla-cms/issues/5734) Fix article language filter in category (issue reported in PR #5734) Jan 15, 2015
@brianteeman brianteeman changed the title Fix article language filter in category (issue reported in PR #5734) Fix article language filter in category (issue reported here : https://github.com/joomla/joomla-cms/issues/5734) Jan 15, 2015
@richard67
Copy link
Member

@JoomliC Shouldn't it be "$db->quote(parent.language) . ',' . ..."?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5740.

@cyrezdev
Copy link
Contributor Author

@richard67 you're right about the quote ;-)

But i wonder now if the issue is reported is really here, and not in the fact of filtering by language only if JLanguageMultilang::isEnabled() return true...
(because you can select language for content even if multilang is not activated...)

@brianteeman
Copy link
Contributor

(because you can select language for content even if multilang is not activated...)

But does it do anything if you do? Isnt it just a tag/label for admin info and not actually usable in any way??

@cyrezdev cyrezdev changed the title Fix article language filter in category (issue reported here : https://github.com/joomla/joomla-cms/issues/5734) Fix filter language in category (issue reported here : https://github.com/joomla/joomla-cms/issues/5734) Jan 16, 2015
@cyrezdev
Copy link
Contributor Author

@brianteeman i'm very sorry, i was taking the issue in the wrong way... (shame on me!)

So, i have updated this PR to add filtering of parent category and subcategories by language (which is the main issue reported in #5734, but for articles, i don't have the issue...)

@infograf768
Copy link
Member

@test
If I follow exactly the instructions above,
Lang2 after patch: when I display the menu item tagged to Lang2 (blog for catlang1 containing an article lang2), I get a 404 .
Before patch, it displays the article

Lang1 after patch: When I display the same menu item tagged to Lang1 (for catlang1 containing an article lang2), I get "There are no articles in this category. etc.-in the language)
Before patch : same.

Is that what you want?

@toslan
Copy link

toslan commented Jan 16, 2015

Still does not filter category since function getCategory() in /components/com_content/models/category.php returns it regardless of language selected.
Could you consider this patch?
#5734


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5740.

@toslan
Copy link

toslan commented Jan 16, 2015

Sorry, this is the right ref for my previous comment: #5756


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5740.

@cyrezdev
Copy link
Contributor Author

If I follow exactly the instructions above,
Lang2 after patch: when I display the menu item tagged to Lang2 (blog for catlang1 containing an article lang2), I get a 404 .
Before patch, it displays the article
Lang1 after patch: When I display the same menu item tagged to Lang1 (for catlang1 containing an article lang2), I get "There are no articles in this category. etc.-in the language)
Before patch : same.
Is that what you want?

Yes, it is, but needs testing too for subcategories.

About 404 "Category not found", to prevent this error page in frontend, a checking to not allow to create a menu in lang1 with parent category in lang2 could be added...

But @tosian the first reporter of the issue, has opened a new PR #5756 with maybe a better way of fixing this issue, so i will close this one.
@tosian, could you update description in your last PR to give all the needed test to be done ? Thx!

@cyrezdev cyrezdev closed this Jan 16, 2015
@toslan
Copy link

toslan commented Jan 16, 2015

@JoomliC Should I reopen #5734 and close #5756 ? How to move the code there? Sorry I am new to all this staff


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5740.

@cyrezdev
Copy link
Contributor Author

@toslan just let it at it is, it's okay! Only #5756 open
Just edit to remove the space tab at end of line, and add tabs before comment.

To help you in joomla code standard : http://joomla.github.io/coding-standards/

And welcome for your first PR #5756 👍

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

Successfully merging this pull request may close these issues.

None yet

6 participants