Today was a pretty uneventful – some might even say boring – day until I noticed a SERIOUS problem with the website I’m working on.
Here’s the situation. For a project, I’m using Joomla!, K2 and Joomfish. Most of the site was built around the K2 component; and I use Joomfish for the translations. The last component proved to be a pain in the ass.
The problem? When using the “translated” version of my site, Joomfish had butchered my menu items. Everything worked fine where I link to a single K2 item – which is why it took so long for me to spot the problem. But when I visited one of the “Category pages”, I was shown a lot of information that shouldn’t be there. All K2 items were thrown together on one page, instead of showing only the items of the selected category.
Now what? I tried to analyze the problem -> Joomfish did something to my menu’s, and I assumed it had to do with K2. I was correct!
Solution
If, like me, you’re using a combination of K2 and Joomfish, and your menu starts to behave strangely, the fix is simple. Chucknology posted a solution on the K2 community forums.
The problem lies with Joomfish and how it “translated” menu links. When K2 comes into play, things can go wrong. Who’s fault is that? I don’t know. Alle I know is that Chucknology came up with a solution that works.
What you’ve got to do, is this:
- Download C’s customized menu.xml file. For your convenience, I’ve uploaded it to my Skydrive.
- FTP to your site: administrator > Components > com_joomfish > contentelements
- Overwrite the file menu.xml with the one you just downloaded. My advice is to rename the “old” file first, to something like notworking_menu.xml
That’s not all. Now, head back to your Joomla! site and go to the “translated” menu items. Scroll way down to the bottom, where you’re asked to translate the link. Click ‘copy’ and then click ‘save’. Repeat for every menu item that’s been misbehaving.
Credit goes to Chucknology (whatever his real name is) for coming up with the fix. I am merely a messenger.
Categories: Joomla
thanks too.
LikeLike
I came across this problem just now…
The cause seems to be the existence of two hidden html form input fields titled “task” and “id”. The menu url is a read-only text (god knows why?), and the menu.xml specifies that these should have the “saveUrlParams” function run on them (in models -> ContentObject.php). The problem is, that this function takes the menu url text you’ve put in, and checks every separate parameter in it versus any matching form input fields. If there are any, it will rewrite their value to those in the form input.
that’s why something like
index.php?option=com_k2&view=itemlist&layout=category&task=category&id=1
gets replaced with
index.php?option=com_k2&view=itemlist&layout=category&task=&id=
resulting in completely broken translated pages.
Your fix sets these links to NOT run the saveUrlParams function. I’m not sure if that is the perfectly correct thing to do, it looks like it does some kind of url sanitization. I’m not sure.
But, your solution works – I’m just wondering if not pulling this function has any ill effects. It has to be there for some reason…
LikeLike
hi
its long time since i worked on old joomla 1.5, but that is what my customer have.
i have to say your fix worked perfectly for me!!!
i will keep your site url in my favorites.
thanks allot and all the best for you guys.
LikeLike
Great to see the article was useful! To be honest, I had to apply this trick myself a week or two ago, on a J! site we can’t update yet.
LikeLike
Didnt work for me..same problem exist, nothing changed..menus are a messssss.
LikeLike
So simple! Many thanks for this solution. It saved me from a big headache!
LikeLike
Really helpful post. I also noticed that sometimes when one translates a menu item using joomfish it mess up the parameters (basics) -leading, intro, columns and links- from language to language. I had to adjust’em manually. [perhaps it happened to me because I am working on an english-chinese site, where chinese language seems to be particularly buggy-
Cheers!.
LikeLike
Thank you! 🙂
LikeLike
Thank you Steven, I’ve been searching a lot for this!
LikeLike
THANKS A LOT!!!!
LikeLike
Thanks !!!!! 🙂
LikeLike
Thanks very much!!! I have spent several days before find this solution!! CHEERS
LikeLike
:* I love you for this wery Usefull solution!
LikeLike
Thanksssssssssssssss a Lot….. I was about to loose a project for this. you made it…. God Blessss youuuu… 🙂
LikeLike
It work perfectly.
But a can’t find how to translate K2 Items. When I’m in K2 area cannot display “translate to:”
What I must to do?
LikeLike
If I’m not mistaken, you’ve got to translate the K2 items using the Joomfish component; not the K2 component.
LikeLike
Perfect, thanks for documenting this. I think I have about 4 sites coming up with k2 and joomfish, I’ll need this for all of them. Simple fix that works perfectly.
LikeLike
Dude… ur a lifesaver 🙂
THANK YOU !!! 🙂
LikeLike
No problem. Just trying to help where I can! 🙂
LikeLike
Thank you so much ! I was going desperate trying to figure out what the problem was. I was about to give up but then you came along in my google search. Cudos both to you and Chucknology !
LikeLike
Glad to see we could help you fix your problem 🙂
LikeLike
Warning: DOMDocument::load() [domdocument.load]: Entity ‘nbsp’ not defined in /home***/administrator/components/com_joomfish/contentelements/menu.xml, line: 247 in /home/***/administrator/components/com_joomfish/classes/JoomfishManager.class.php on line 185
What could be the problem? I added this xml…
LikeLike
Thanks, it worked just awesome.
First I did this:
http://www.joomfish.net/forum/viewtopic.php?f=21&t=7634&p=30014#p30192
And changed the line 447 of this same file mentioned above on that forum, which is this:
$maxLength = ($field->MaxLength>0)?$field->MaxLength:60;
To this:
$maxLength = ($field->MaxLength>0)?$field->MaxLength:100;
That’s it! 🙂
LikeLike
Pedro, thank you for your usefull addition to the article.
LikeLike
Thanks to both for the fix!!
saved tons of time.
Sandra 🙂
LikeLike
Hello, THANNKKKKKKK!!!!! IT’s work for me, I had the same problem, only change in menu.xml the line field type=”readonlytext” name=”link” translate=”1″ posthandler=”saveUrlParams” prehandler=”checkUrlType”….. and replace with field type=”text” name=”link” translate=”1″ posthandler=”saveUrlParams” prehandler=”checkUrlType” …. . that its all. thank Chucknology
LikeLike
Hello, THANNKKKKKKK!!!!! IT’s work for me, I had the same problem, only change in menu.xml the line Link and replace with Link. that its all. thank Chucknology
LikeLike
Hi,
i need very urgently of file.. but is no longer available 😦
could someone post it? thxxxxxx
I have version 1.5.15 of Joomla, Joom! Fish Version v2.0.4, K2 v2.0
LikeLike
Fabry,
The file is still available on the location I posted.
I’ve taken the liberty to mail it to you, as well, assuming you check the e-mail adress you used to post this reply 😉
LikeLike
Thanks. While I was developing the official website from my organization I run into the same problem. Your xml fixed the issue. I see it only was a problem with category list view. It would be helpful if Alex from K2 made a official entry on the site to submit solutions like yours, instead of searching for hours on their forum. Thanks again.
LikeLike
Martin,
Glad to see this worked for you!
Like I said in the post: the xml fix isn’t really ‘my’ solution. Can’t take any credit there! I found it on a forum (K2’s forum perhaps?) but it took me so long to find that I decided to put it on my blog.
And voila… people who don’t find the solution on the forum find it here. My job is done 🙂
LikeLike
Cheers for the post – found it quickly through google and worked as descibed.
Thanks again
LikeLike
Jake,
Glad to see it worked! It seems like Google is showing us lots of love lately 😉
LikeLike
Thank you for posting this. I didn’t find it in the K2 forum, so you got me there. And thanks for the clear instructions.
LikeLike
I believe that the forum was my ‘source’ for this solution. But the forum’s not very “search” friendly so I’m glad I could help you. 🙂
LikeLike
Finally i solved my problem. Thank you very much. you are awesome 🙂
LikeLike
Glad to see that it worked for you! 🙂
LikeLike
Thank you very much Chucknology and Steven for posting this solution!
I must say that this fix worked perfectly for me too!!!
LikeLike
Thanks very much! had the same problem and works perfectly now
LikeLike