Incorrect Menu links for categories

Hi,
I am using magento 1.7.0.2 and your template jm Mago.
it creates a weird problem with menu category links. I have 5 sites, each site has its own store and store view.
I want to add category links to menu. Before when I was using same category link for all stores, every category and subcategory link used to become the link of first category. Later on i changed the urls for each category according to its store, so each category has its own link according to website.
My first problem is when i put a custom link to a category, it does not get it as root link. But it appends it with current link. for example if i am on root abc.com and my custom link was def.html, it will take me to right page abc.com/def.html. But if i am on any other sub category page of website, It appends the url, which tell 404 page. for example if i am on abc.com/xyz/pqr.html and i click on category in menu it would direct me to abc.com/xyz/def.html which is not direct link. how i can set custom link so it direct me to exact page.

My second problem, which is more weird, when i do not put custom link, but choose category instead. it gives me the category link of other store view. like if i have different url for english and swedish stores, it will set swedish url of that category anyway in even english menu.
It seems a huge bug is there.

Any help would be highly appreciated.
Thanks in advance.
mysite
http://goldenlocks.dk

6 answers

Profile photo of Daniel Olsson 0.00 $tone July 17, 2013
Public

Hi,
here is what my system log says
2013-07-17T04:19:09+00:00 ERR (3): Notice: Undefined index: 123 in /var/www/lib/megamenu/mega.class.php on line 114
2013-07-17T04:19:09+00:00 ERR (3): Notice: Trying to get property of non-object in /var/www/lib/megamenu/mega.class.php on line 373
2013-07-17T04:19:09+00:00 ERR (3): Warning: in_array() expects parameter 2 to be array, null given in /var/www/lib/megamenu/mega.class.php on line 377
2013-07-17T04:19:09+00:00 ERR (3): Notice: Trying to get property of non-object in /var/www/lib/megamenu/mega.class.php on line 398
2013-07-17T04:19:09+00:00 ERR (3): Notice: Trying to get property of non-object in /var/www/lib/megamenu/mega.class.php on line 189
2013-07-17T04:19:09+00:00 ERR (3): Notice: Undefined variable: fixitem in /var/www/lib/megamenu/mega.class.php on line 128

also

2013-07-17T07:01:46+00:00 ERR (3): Notice: Undefined variable: listfake in /var/www/app/code/local/Wavethemes/Jmmegamenu/Block/Adminhtml/Jmmegamenu/Grid.php on line 69
2013-07-17T07:01:46+00:00 ERR (3): Warning: Missing argument 1 for Wavethemes_Jmmegamenu_Block_Adminhtml_Jmmegamenu_G rid::getCurPage(), called in /var/www/app/design/adminhtml/default/default/template/widget/gridmenu.phtml on line 62 and defined in /var/www/app/code/local/Wavethemes/Jmmegamenu/Block/Adminhtml/Jmmegamenu/Grid.php on line 46
2013-07-17T07:01:46+00:00 ERR (3): Warning: Missing argument 1 for Wavethemes_Jmmegamenu_Block_Adminhtml_Jmmegamenu_G rid::getLastPage(), called in /var/www/app/design/adminhtml/default/default/template/widget/gridmenu.phtml on line 63 and defined in /var/www/app/code/local/Wavethemes/Jmmegamenu/Block/Adminhtml/Jmmegamenu/Grid.php on line 51
2013-07-17T07:01:46+00:00 ERR (3): Warning: Missing argument 1 for Wavethemes_Jmmegamenu_Block_Adminhtml_Jmmegamenu_G rid::getLastPage(), called in /var/www/app/design/adminhtml/default/default/template/widget/gridmenu.phtml on line 78 and defined in /var/www/app/code/local/Wavethemes/Jmmegamenu/Block/Adminhtml/Jmmegamenu/Grid.php on line 51
2013-07-17T07:01:46+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /var/www/app/design/adminhtml/default/default/template/widget/gridmenu.phtml on line 171
2013-07-17T07:01:46+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /var/www/app/design/adminhtml/default/default/template/widget/gridmenu.phtml on line 171
2013-07-17T07:01:46+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /var/www/app/design/adminhtml/default/default/template/widget/gridmenu.phtml on line 171
2013-07-17T07:01:52+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /var/www/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /var/www/lib/Zend/Controller/Response/Abstract.php:766
[2] /var/www/app/code/core/Mage/Core/Controller/Response/Http.php:83
[3] /var/www/app/code/core/Mage/Core/Controller/Varien/Front.php:188
[4] /var/www/app/code/core/Mage/Core/Model/App.php:354
[5] /var/www/app/Mage.php:683
[6] /var/www/index.php:87

#3
Profile photo of Sherlock 0.00 $tone July 17, 2013
Public

Hi goldenblocks,

Sorry for this late ๐Ÿ™

My first problem is when i put a custom link to a category, it does not get it as root link. But it appends it with current link. for example if i am on root abc.com and my custom link was def.html, it will take me to right page abc.com/def.html. But if i am on any other sub category page of website, It appends the url, which tell 404 page. for example if i am on abc.com/xyz/pqr.html and i click on category in menu it would direct me to abc.com/xyz/def.html which is not direct link. how i can set custom link so it direct me to exact page.

You can use this kind of link for the custom link menu type
base_url/no-route
Notice the base_url here that will be replaced by your base url.
To get that kind of link works you need a little modify, Open the file of lib\megamenu\mega.class.php around line number
398 you would see this code

PHP Code:

   //Add page title to item
            
if ($tmp->megaparams->desc) {
                
$txt .= '<span class="menu-desc">'JText::_($tmp->megaparams->desc).'</span>';
            } 




you add right below it this new code

PHP Code:

  //replace base_url by real base url
            
if($tmp->menutype == && (strpos($tmp->link,"base_url") >= 0)){
               
$tmp->link str_replace(base_url,Mage::getBaseUrl(),$tmp->link);
            } 



My second problem, which is more weird, when i do not put custom link, but choose category instead. it gives me the category link of other store view. like if i have different url for english and swedish stores, it will set swedish url of that category anyway in even english menu.
It seems a huge bug is there.

How can you set different URL Key for your categories per stores ? I tried with one of our demo but it seem impossible with magento 1.7.0.2 you can pm me your FTP info for further checking this issue (in case you choose category link instead of custom link).

#4
Profile photo of Daniel Olsson 0.00 $tone July 18, 2013
Public

thanks for the solution.
i have made it with base_url now.
I had done a change in category url scope via db, so to make it on store level. it did not go well so i tried changing category urls in url rewrite management which was working perfect except in megamenu category links.

Regards

#5

Please login or Register to Submit Answer

Written By

Comments