Making JReviews Menus active when viewing listing detail pages

From JReviews Documentation
Revision as of 14:17, 12 August 2013 by Jreviews (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When someone views listing detail page, the JReviews Category menu items will not became active.

That is because listings don't share the same ItemIds as JReviews Section/Category menu items.

Listings have the ItemIds of the Joomla Article Category menu items.

You probably created those menu items in a Hidden Menu. If not, do that like instructed in this article: Creating Required Joomla Menu Items

When you know the Ids of Hidden Joomla menu items and Ids of JReviews menu items, you can add a hack in the index.php file of your joomla template:

Open this file:

  • root\templates\{your_template}\index.php

Changes for Joomla 2.5+

Find this line:

defined('_JEXEC') or die;


and add the hack below it:

$Itemid = JRequest::getInt('Itemid');
$menu = JFactory::getApplication()->getMenu();
// Repeat for every JReviews menu that needs to become active
if($Itemid == 211){  // example of the itemId of Joomla menu item
    $menu->setActive(143); // example of the itemId of JReviews menu item
}


Now the JReviews menu item with Id 143 will become active when the listing detail page with itemId 211 is viewed.


Changes for Joomla 1.5

The first lines in the file probably look something like this:

<?php
( '_JEXEC' ) or die( 'Restricted index access' );
define( 'YOURBASEPATH', dirname(__FILE__) );
?>


Add this hack above the closing php tag:

global $Itemid;
$menu = &JSite::getMenu();
 
// Repeat for every JReviews menu that needs to become active
if($Itemid == 125){  // example of the itemId of Joomla menu item
    $menu->_active = 48; // example of the itemId of JReviews menu item
}


Now the JReviews menu item with Id 48 will become active when the listing detail page with itemId 125 is viewed.