Categories' links in the FronPage get Home 's Itemid

Started by panoss, March 28, 2017, 19:18:44 PM

Previous topic - Next topic

panoss

My Home page, which has menu type = Virtuemart FrontPage, has Itemid=133.
7 categories are listed in the front page, and their links have Itemid=133, which is wrong, this is the home 's Itemid.
Why do they get the home 's Itemid? Should I change some setting?

In file: ...\lioncycles\components\com_virtuemart\sublayouts\categories.php, at line 64:

$caturl = JRoute::_ ( 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id , FALSE);

This is where the Itemid is added.
Virtuemart 3.2.4 on Joomla! 3.8.0

panoss

This is my site, you see 7 photos and above each photo a link.
These are the top categories.

1. Click on the photo of the bikes and you 'll see no Itemid exists in the url.

2. Click 'Home' menu, then click 'Bikes' link again. Now, Itemid exists in the url!!! (but it's the Home Itemid, 133)

How can I fix this?
Virtuemart 3.2.4 on Joomla! 3.8.0

panoss

I (kind of) resolved it like this:
(the menuitems belong to a menu named 'mainmenu')

$menutype = 'mainmenu';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id', 'link')));
$query->from($db->quoteName('#__menu'));
$query->where($db->quoteName('menutype') . ' = ' . $db->quote($menutype));
$query->order('id ASC');
$db->setQuery($query);
$Itemsids_tmp = $db->loadAssocList('id', 'link');


Then from the link, I extract the virtuemart_category_id.
And in the string of the final link ($caturl), I replace the Itemid with the corresponding Itemid that matches with the $virtuemart_category_id.

But this is a query in the subtemplate, which I don't like at all.
Till I find something better,  I 'll have to compromise with this.
Virtuemart 3.2.4 on Joomla! 3.8.0

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

panoss

Yes, but it doesn't.
Or you mean I should change something it the router's code?
Virtuemart 3.2.4 on Joomla! 3.8.0