Collapsed menu while visiting submenu page (alias)

Replied by kiku90 on topic Collapsed menu while visiting submenu page (alias)

Posted 8 years 9 months ago #28304

ced1870 wrote: do you have a FTP access for me where I can check ?

this is a localhost production.

ced1870 wrote: now what I want to know is why this class is not applied to the element :)

As I can see alias menu entry itself has "active" class and "isactive" on href tag, however at the same time, $path variable contains in array only "3383", parent itemid is "3426" and it hasn't got "aliasoptions", so in helper.php around line 167 the "new method for the active class" doesn't applying "active" on parent, because in_array returns false, so it's collapsed.

While using article link menu type, the $path variable contains in array "3426" and "3445", as in example above, parent itemid is "3426", so it is found, in_array returns true and "active" class is applied, so the menu is expanded.

I guess it's all fault of different $path ($base->tree) variable for alias and for other menu positions and the "new method for the active class".
by kiku90

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Collapsed menu while visiting submenu page (alias)

Posted 8 years 9 months ago #28305
yes the problem comes from the tree, this is what I have seen in the code
but I can not reproduce the issue by my side.
Could you please send me a screenshot or explanations on how to create the menu (2 items shall be sufficient) to reproduce this (item type, alias, etc)

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Replied by kiku90 on topic Collapsed menu while visiting submenu page (alias)

Posted 8 years 9 months ago #28363
In the first prntscr there's a menu which contains position marked red (it's single article menu type).

In the second prntscr there's a menu which contains alias to position from first prntscr. This is a menu which doesn't expand automatically while visiting alias.
by kiku90
Attachments:

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Collapsed menu while visiting submenu page (alias)

Posted 8 years 9 months ago #28382
I have reproduced the issue by my side but I also found that the native joomla menu module has the same issue.
So for now I can not solve this quickly because it would need a global recoding of the active tree ...
the problem is that the parent item is not recognized as being in the active tree, because the tree is based on the original item and not the alias

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Replied by kiku90 on topic Collapsed menu while visiting submenu page (alias)

Posted 8 years 9 months ago #28395
Below is my solution to this problem, for me this's working fine (just place it above "// new method for the active class"):
Code:
if($item->type == 'alias' || $item->type == 'heading') { $db = JFactory::getDBO(); $q = $db->getQuery(true); $q->select($db->quoteName('params')); $q->from($db->quoteName('#__menu')); $q->where($db->quoteName('parent_id').' = '.$db->quote($item->id)); $db->setQuery($q); $aliasparams = $db->loadColumn(); foreach($aliasparams as $aliasparam) { $aliasparamsdecode = json_decode($aliasparam); if($aliasparamsdecode->aliasoptions == $active_id) { $item->classe .= ' active'; $item->isactive = true; } } }

let me know what do you think?
Last Edit:8 years 9 months ago by kiku90
Last edit: 8 years 9 months ago by kiku90.

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Collapsed menu while visiting submenu page (alias)

Posted 8 years 9 months ago #28396
wow... :)
if it works for you, ok, but I don't think that I will include it immediately. I have to test and find why the joomla system is not working correctly
the best thing would be to open a ticket on the joomla debug, but I'm actually too busy to work deeper on this :(

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Time to create page: 0.640 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 862 guests and no members online