Keyword

URGENT: Which menu item owns a K2 item when more that one menu item points to it ?

  • Sébastien Auclair
  • Sébastien Auclair's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #87034 by Sébastien Auclair
This is a major issue for us... Our home page points to the News/NewsFlash K2 category.I also have a main menu link item called "News" which also points the same category.If i click on a "NewsFlash" item from the home page or from the "News" main menu link, it always shows the item as being under "www.oursite.com/home/item..." while it should be "www.oursite.com/news/newsflash/item..."This is a major issue for us since we have some modules that should only appear on the home page. Now when we click on a newsflash item, those homepage related modules reaper and it makes no sense !... This bug makes the whole thing look quite ugly and i don't want to patch.Thanks for any help !

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

More
14 years 1 month ago #87035 by Jiliko.net
Hi Sébastien,

Can you confirm the item menu type for Home (Accueil) & News (Nouvelles) are the same.

They both link to only one & same K2 category ?

I'm quite sure K2 retrieves item link from Joomla! menu db table and take the first item id that matches.

Olivier

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

  • Sébastien Auclair
  • Sébastien Auclair's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #87036 by Sébastien Auclair
Both menu items are the same.
The only difference is the fact that our "News" menu item points to both "News" and "Newsflash" categories.

I did this because pointing to more than one categorie enables the parameters that controls how the list of items is to be displayed. The way our newsflash items are to be listed in the front page is different than the way they appear on the News page.
I don't think this has any influence on the bug.

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

More
14 years 1 month ago #87037 by Jiliko.net
Sebastien,

The function that retrieves item route stops at the first match. The list of menu item seems to be sorted by itemid, so the first match is your 'Home' menu item which is used by K2 to route item.

Maybe you should try to change your menu item in 'latest items' view instead of 'itemlist' and configure it to display latest items from related categories. This kind of item menu seems to not be used in K2 routing function.

Olivier

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

  • Sébastien Auclair
  • Sébastien Auclair's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #87038 by Sébastien Auclair
Merci Olivier !!!

From your reply, the solution becomes obvious...

Shame on me for panicking before giving proper thoughts.

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

  • Sébastien Auclair
  • Sébastien Auclair's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #87039 by Sébastien Auclair
Well, false alarm ! This fix doesn't work.

I changed the "Home" menu item's ID to a huge value (375) that makes it the last one.
I also tried to make the "Home" menu item the last one by display order and i even set the "News" menu item as the default one.

In each of the cases above, when clicking on a Flashnews item, even from the "News" page, we always go back to www.mysite.com/HOME/item/theselecteditem...

So the modules that should only appear on the home page (menu item id 375) are displayed again... This is either a bug or a major design error. (On K2 or Joomla side, but don't have any other Joomla installation to test this)

HELP !!! I am desperate !

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

  • Sébastien Auclair
  • Sébastien Auclair's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #87040 by Sébastien Auclair
Solution Found !

Had to change function K2HelpRoute::getItemRoute in route.php under the helpers directory.

For some reason, it was adding a menu item id which seams to me like something not very usefull !
I simply commented that part out.
class K2HelperRoute
{

function getItemRoute($id, $catid = 0) {

$needles = array (
'item'=>(int)$id,
'itemlist'=>(int)$catid,
);
$link = 'index.php?option=com_k2&view=item&id='.$id;

//if ($item = K2HelperRoute::_findItem($needles)) {
// $link .= '&Itemid='.$item->id;
//}

return $link;
}

Now, when you click on a Newsflash item under the "Home" page or the "News" page, the link to it becomes conventional as it should be:
vvvvvv.mysite.com/component/k2/item/73-theselecteditem...

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

More
11 years 11 months ago #87041 by thibaut
Bonjour Sébastien,

Je pense avoir le même problème et je ne trouve vraiment aucune solution.
J'ai tenté de supprimer de route.php la partie dont tu parles mais ça le casse...

Je n'y connais rien au php. Y'a t'il une autre manipulation à effectuer ?

Merci !

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


Powered by Kunena Forum