Author Topic: Categories' links in the FronPage get Home 's Itemid  (Read 483 times)

panoss

  • Jr. Member
  • **
  • Posts: 78
  • A beginner
Categories' links in the FronPage get Home 's Itemid
« on: March 28, 2017, 19:18:44 pm »
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:
Code: [Select]
$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.2 on Joomla! 3.7.4

panoss

  • Jr. Member
  • **
  • Posts: 78
  • A beginner
Re: Categories' links in the FronPage get Home 's Itemid
« Reply #1 on: March 29, 2017, 12:47:13 pm »
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.2 on Joomla! 3.7.4

panoss

  • Jr. Member
  • **
  • Posts: 78
  • A beginner
Re: Categories' links in the FronPage get Home 's Itemid
« Reply #2 on: April 08, 2017, 12:50:28 pm »
I (kind of) resolved it like this:
(the menuitems belong to a menu named 'mainmenu')
Code: [Select]
$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.2 on Joomla! 3.7.4

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9327
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Categories' links in the FronPage get Home 's Itemid
« Reply #3 on: April 10, 2017, 08:57:20 am »
The router should do this.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

panoss

  • Jr. Member
  • **
  • Posts: 78
  • A beginner
Re: Categories' links in the FronPage get Home 's Itemid
« Reply #4 on: April 11, 2017, 13:45:54 pm »
Yes, but it doesn't.
Or you mean I should change something it the router's code?
Virtuemart 3.2.2 on Joomla! 3.7.4