I have changed the:
administrator\components\com_phocagallery\libraries\phocagallery\path\route.php
done some tests and should work:
Code: Select all
class PhocaGalleryRoute
{
function getCategoriesRoute() { ...
call following method:
Code: Select all
if($item = PhocaGalleryRoute::_findItem($needles, 1)) {
The _findItem looks:
Code: Select all
function _findItem($needles, $notCheckId = 0) {
$component = &JComponentHelper::getComponent('com_phocagallery');
$menus = &JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
$currentItemId = JRequest::getVar('Itemid', 0, '', 'int');
if(!$items) {
return JRequest::getVar('Itemid', 0, '', 'int');
}
$match = null;
foreach($needles as $needle => $id) {
if ($notCheckId == 0) {
// Try to find the same Itemid like the current site has
// The itemid of current site can be itemid of other view
// In such case and in case no itemid will be found
// try to find some other itemid
// Example: categories view - if not found: currentItemid is not
// found in categories view, try to find some other
// categories view itemid (by backlinks e.g.)
$sameIdFound = 0;
foreach($items as $item) {
if ((int)$currentItemId > 0) {
if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id) && ($currentItemId == $item->id)) {
$match = $item;
$sameIdFound = 1;
break;
}
}
}
// Continue searching of other itemid
if ($sameIdFound == 0) {
foreach($items as $item) {
if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id)) {
$match = $item;
break;
}
}
}
} else {
$sameIdFound = 0;
foreach($items as $item) {
if ((int)$currentItemId > 0) {
if ((@$item->query['view'] == $needle) && ($currentItemId == $item->id)) {
$match = $item;
$sameIdFound = 1;
break;
}
}
}
if ($sameIdFound == 0) {
foreach($items as $item) {
if (@$item->query['view'] == $needle) {
$match = $item;
break;
}
}
}
}
if(isset($match)) {
break;
}
}
return $match;
}
It means, first the needles will be searched, e.g. view = categories. If this is found, then the script will try to find such menu item with the same Itemid which is on the current site (the itemid can be itemid of other view e.g. of category view, so it must be checked if 1. is categories view itemid, 2. there is some menu link, 3. itemid of menu link is the same as itemid of current site)
If there is no itemid which is the same as currentitemid in menu link, then the script will try to search some categories view itemid so the backlink can be created.
Will be added into the next version.
Jan