new menu item - wrong address

Need help with the Administration of your Joomla! 2.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
rgipr
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri May 04, 2012 10:40 am

new menu item - wrong address

Post by rgipr » Fri May 04, 2012 10:53 am

Hi folks,

I have strange behavior on one of my sites:
When I create a new menu item e.g. "www.mypage.com/newmenu" I'm redirected to "www.mypage.com/Links/newmenu" and receive a 404 error.

I couldn't find any useful information on my internet search, the only hint I found:
Search Engine Friendly URLs - as soon as I switch it of, the links are working again.

I also found out, there is a table called "j25_menu" in my database where the field "path" shows exactly this wrong link after the creation. I tried to change the value there (remove the "Links/" in front of the "newmenu) and it works. As soon as I save the menu item in the backend again, it points to the wrong location again.

As an additional information: the site was migrated from 1.5.24 to 2.5.3 with the migration script mentioned in the official documentation...

Thanks,
ipr

javix
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Jan 31, 2009 10:33 pm

Re: new menu item - wrong address

Post by javix » Thu May 10, 2012 6:22 pm

Hi,

I have exactly the same problem.

If I enable SEF Urls, my menu items stop working!

In my case the language is spanish and I get /Búsqueda Inteligente/name-of-menu

This is the most weird thing I have never experienced in Joomla!

SEF Urls is a must.

Thank you @rgipr for the table hint.
There is this "path" field, that states "The computed path of the menu item based on the alias field."
but it is not. In my case, it had "Búsqueda Inteligente" in front.

Are we the only ones with this behaviour?

I am using 2.5.4., a clean installation.

I was trying joomla 2.5. for the first time with this website, but I am now wondering if I should go on this path. Seems risky...

javix
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Jan 31, 2009 10:33 pm

Re: new menu item - wrong address

Post by javix » Thu May 10, 2012 6:36 pm

They are having the same issue here:
* http://forum.joomla.org/viewtopic.php?f=579&t=702203
* http://forum.joomla.org/viewtopic.php?f ... &p=2805667

Probably there is more people having this.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: new menu item - wrong address

Post by infograf768 » Fri May 11, 2012 5:59 am

Disable cache. Clear cache. Then go to your Menu Manager and Rebuild each menu.
This should solve it.

Make sure your non-core extensions are up-to-date.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

javix
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Jan 31, 2009 10:33 pm

Re: new menu item - wrong address

Post by javix » Fri May 11, 2012 8:54 am

OK, that fixes it. Thank you.

Why would that happen in the first place?

Thanks, regards

rgipr
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri May 04, 2012 10:40 am

Re: new menu item - wrong address

Post by rgipr » Tue May 15, 2012 3:01 pm

Thanks, great success! :)

igroove
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Jan 23, 2011 4:09 pm

Re: new menu item - wrong address

Post by igroove » Wed Aug 01, 2012 12:25 pm

I'm having this same issue on a site that I upgraded from 1.5 to 2.5. Every single new menu item I create adds the word Banners to the path field in the #__menu table (i.e. instead of sef url being http://mysite.com/menu-item, its http://mysite.com/banners/menu-item. I have followed the instructions to clear cache and rebuild all menus, and that fixes any menu items already created by removing banners from the path field, but new menu items added still have the same issue... Pulling my hair out on this one. Any ideas?

Thanks,
Jason

User avatar
pxforti
Joomla! Hero
Joomla! Hero
Posts: 2755
Joined: Wed Apr 04, 2007 8:54 pm
Location: Driggs, Idaho

Re: new menu item - wrong address

Post by pxforti » Wed Sep 26, 2012 8:58 pm

I spent 3 hours chasing this issue around. Finally found to correct search terms to find this tread. I was getting some serious heartburn. Just wondering why this happens and why it's necessary to "Rebuild" the menu.

Any ideas?
Joomla Website Design / CS-Cart Website Design
http://writenowdesign.com

dvlancer
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Thu Jul 26, 2012 1:22 am
Location: Australia
Contact:

Re: new menu item - wrong address

Post by dvlancer » Mon Apr 01, 2013 12:28 am

I had the same issue after migrating J1.5 to J2.5.6. Except I get "Categories/" appended to a menu path column in the menu table.

Rebuilding fixed the menu, but only until a new menu was created or an existing menu was edited.

I narrowed the source of this problem down to the nested sets data stored in #__menu table (lft and rgt columns)

The odd prefix is added to the menu path after the code below (JROOT/libraries/joomla/database/table/menu.php lines 188-202, J2.5.6) is executed.

Following the code snipped below is an SQL query that returns a result requested by $this->getPath(). This result uses nested sets data stored in #__menu table. In my case I had a menu item with menutype: menu, title: com_weblinks_categories, alias: Categories, lft 44 and rgt 79, which looked odd, compared to other joomla installs. As a result "Categories/" was appended to all new and edited menus as per code sniped below ($newPath = trim(implode('/', $segments), ' /\\');)

I fixed the issue by searching for the right most value (the highest rgt value), which was 74 in my case, and replaced values for lft (44) and rgt (79) with the next two consequent numbers, which were 75 and 76 respectively.

Then I updated rgt value for row with id = 1 and title = Menu_Item_Root to 77 (which is the right most value + 1)

This permanently fixed the problem described above. The above values will depend on your data in #__menu table.

I wonder if this behaviour is only common to Joomla site that were migrated from J1.5 using jupgrade.

Code: Select all

		// Get the new path in case the node was moved
		$pathNodes = $this->getPath();
		$segments = array();
		foreach ($pathNodes as $node)
		{
			// Don't include root in path
			if ($node->alias != 'root')
			{
				$segments[] = $node->alias;
			}
		}
		$newPath = trim(implode('/', $segments), ' /\\');

		// Use new path for partial rebuild of table
		// Rebuild will return positive integer on success, false on failure
		return ($this->rebuild($this->{$this->_tbl_key}, $this->lft, $this->level, $newPath) > 0);

Code: Select all

SELECT p.*
FROM j25_menu AS n, j25_menu AS p
WHERE n.lft BETWEEN p.lft AND p.rgt AND n.id = 2
ORDER BY p.lft
Let me know if there is a better way to solve this.

peanuts68
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Wed Jul 10, 2013 8:54 am

Re: new menu item - wrong address

Post by peanuts68 » Thu Oct 10, 2013 3:58 pm

The post by dvlancer was very helpfull, I'm struggling with the same issue, not solved yet though.
I checked my #_menu table and found out that several items added since upgrading to 2.5 have duplicate values for lft and rght.
For instance com-newsfeeds-categories has left 37 and right 38. My recently added menu-item also has lft 37 and rght 38. So when I edit my menu-item and save it to the database, the script mentioned above checks for the alias of the item with the lft-value 37, copies the alias, and uses it to rewrite the alias for my menu-item.
My menu-item than suddenly has the alias feeds/categories/item and my menu now produces a 404-error.
Rebuilding the menu temporarily fixes this. But everytime my menu-item is modified, the error returns. Changing the left and right values manually has no effect, after rebuilding the menu the old values are placed back again in the table.
Anyone know how to repair this? It looks like problems with the assets-table, but menu's aren't listed there. Duplicate left and right values seem to be the cause of this.

peanuts68
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Wed Jul 10, 2013 8:54 am

Re: new menu item - wrong address

Post by peanuts68 » Fri Oct 11, 2013 10:02 am

Found some additional information on the Jupgrade-website. I used Jupgrade to migrate from 1.5 to 2.5. It seems Jupgrade is causing the problem.
The backup I made after upgrading shows a correct table, the problem starts when I create or modify a new menu-item.
Here's some info: http://redcomponent.com/92-jupgrade/127 ... mitstart=0
I haven't tried the solutions mentioned there yet.

peanuts68
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Wed Jul 10, 2013 8:54 am

Re: new menu item - wrong address

Post by peanuts68 » Fri Oct 11, 2013 11:30 am

The method described by 'dima' on the Red Component Forum worked for me:
(Joomla 2.5.14)
First my English is not very good.
I tried to solve this problem two days and found how to solve it.
I don't know if it is the best way to solve it, but in my site it works good

here
administrator\components\com_menus\models\item.php
in function

public function save($data)


at the end before

return true;


I add

$table->rebuild();

User avatar
Helvecio
Joomla! Explorer
Joomla! Explorer
Posts: 468
Joined: Wed Oct 10, 2007 2:29 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: new menu item - wrong address

Post by Helvecio » Tue Mar 31, 2015 1:16 am

What I find really weird is that there is a menu item to com_banners that I NO idea how it wound up there. This site I'm working on never used banners.
Helvecio "Elvis" da Silva
Graphic and Web Designer
Joomla Website Developer
http://hlvc.design

piersol
Joomla! Intern
Joomla! Intern
Posts: 66
Joined: Wed Sep 26, 2007 6:11 pm
Location: Indianapolis

Re: new menu item - wrong address

Post by piersol » Wed Nov 04, 2015 4:23 am

My issue was also one where "Banners" was added to my sef url for new menu items. It broke the link and no new menu items worked. Old ones remained fine.

Cache wasnt my issue. But this solution did work indeed on my J3.4.5 site.
First my English is not very good.
I tried to solve this problem two days and found how to solve it.
I don't know if it is the best way to solve it, but in my site it works good

here
administrator\components\com_menus\models\item.php
in function

public function save($data)


at the end before

return true;


I add

$table->rebuild();
Only exact URLs allowed in signature. Please read Forum Rules: http://forum.joomla.org/viewtopic.php?f=8&t=65

slenn78
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Sep 16, 2016 11:53 am

Re: new menu item - wrong address

Post by slenn78 » Fri Sep 16, 2016 12:24 pm

the infograf768 works perfectly. Thank you very much!


Locked

Return to “Administration Joomla! 2.5”