-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
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>
@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. |
@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... |
But does it do anything if you do? Isnt it just a tag/label for admin info and not actually usable in any way?? |
@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...) |
@test 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) Is that what you want? |
Still does not filter category since function getCategory() in /components/com_content/models/category.php returns it regardless of language selected. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5740. |
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. |
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. |
@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. |
@toslan just let it at it is, it's okay! Only #5756 open To help you in joomla code standard : http://joomla.github.io/coding-standards/ And welcome for your first PR #5756 👍 |
Fix for issue reported here : #5734
Add check of parent category language