bug in mod_phocagallery_image

Phoca Gallery - image gallery extension
rob-van-baal
Phoca Member
Phoca Member
Posts: 27
Joined: 14 Jan 2011, 21:15
Location: Netherlands
Contact:

bug in mod_phocagallery_image

Post by rob-van-baal »

I have installed Image module and it shows random pictures as I have configured it to do. OK!
When I click on the picture, it opens the detail picture (or the category; whatever I configure). OK!
When I close the picture I and us the "back" button to go back to the galery, the default number of thumbnails are showed. OK!
But at the bottom of the screen (catagory view) there is no previous/next navigation anymore. NOT OK!
Only when I enter the category via the Phoca Galery links from the main menu, I get the page navigation.
Check it out on http://www.fischertechnikclub.nl. Choose the language you like.

Can anyone provide me with a code fix which I can apply?
And if it is a real bug, can it be solved in the 3.0 software for J1.6?

Appriciate the help.

Regard, Rob
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: bug in mod_phocagallery_image

Post by Jan »

Hi, seems, like your module didn't get the right itemid, see:
https://www.phoca.cz/documents/16-joomla ... -in-joomla

Jan
If you find Phoca extensions useful, please support the project
rob-van-baal
Phoca Member
Phoca Member
Posts: 27
Joined: 14 Jan 2011, 21:15
Location: Netherlands
Contact:

Re: bug in mod_phocagallery_image

Post by rob-van-baal »

Hi Jan,

I agree on the fact that the Image module cannot find the itemid for any link.
But after reading the article you mentioned: I have already a module link active from the mainmenu to PhocaGallery module (called "Photo Gallery" when using the English language and has itemid 113 which I need).
I also tried what was described in the article (extra menu + modulelink with itemid 114) but it does not result in your Image module to find any itemid when building up the URL for the choosen image.

I even tried turning SEF plugin off but that also doesn't lead to itemid in URL.

Do you have another suggestion?

Rob
rob-van-baal
Phoca Member
Phoca Member
Posts: 27
Joined: 14 Jan 2011, 21:15
Location: Netherlands
Contact:

Re: bug in mod_phocagallery_image

Post by rob-van-baal »

Hi Jan,

I have searched in the source code looking for where you build up the URL. I found it in the module mod_phocagallery_image.php of the Phoca Image component:

Code: Select all

		// ROUTE
		if ($tmpl['detailwindow'] == 7) {
			$suffix	= 'detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons;
		} else {
			$suffix	= 'tmpl=component&detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons;	
		}
		$siteLink 	= JRoute::_(PhocaGalleryRoute::getImageRoute($valueImages->id, $valueImages->catid, $valueImages->alias, $valueImages->catalias, 'detail', $suffix )); 
I really can not find any code that looks like building up a itemid... :(

But since I know under which itemid PhocaGallery is running, I applied a patch:

Code: Select all


		// ROUTE
		if ($tmpl['detailwindow'] == 7) {
//			$suffix	= 'detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons;
			$suffix	= 'detail='.$tmpl['detailwindow'].'&Itemid=113&buttons='.$detail_buttons;
		} else {
			$suffix	= 'tmpl=component&detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons;	
		}
		$siteLink 	= JRoute::_(PhocaGalleryRoute::getImageRoute($valueImages->id, $valueImages->catid, $valueImages->alias, $valueImages->catalias, 'detail', $suffix ));
I hard coded the itemid in it... 8) and guess: It works fine now :twisted: . The Phoca Image "module" can now go on as the Phoca Gallery "component" as soon as the picture has been viewed.

But it is not a very nice and future proof solution. So if you might see a way to get the itemid back in on a nice way, please do so.

Rob
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: bug in mod_phocagallery_image

Post by Jan »

Hi, the itemid is assigned in this method:

PhocaGalleryRoute::getImageRoute

Jan
If you find Phoca extensions useful, please support the project
rob-van-baal
Phoca Member
Phoca Member
Posts: 27
Joined: 14 Jan 2011, 21:15
Location: Netherlands
Contact:

Re: bug in mod_phocagallery_image

Post by rob-van-baal »

Hi Jan,

Yes, that is a better place to make the modfication. I have fixed it now in all three routing functions:
getCategoriesRoute
getCategoryRoute
getImageRoute

And that solves the Image plugin problem perfectly.

Extra advantage is now that if I have a search result from the Phoca Search plugin, each link (picture or category) also comes with an Itemid. I was missing the page navigation there too and that is now also solved after selecting the link.

Rob
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: bug in mod_phocagallery_image

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
appaloosa
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 13 Feb 2011, 11:46

Re: bug in mod_phocagallery_image

Post by appaloosa »

Could You tell me how to fix this problem with this "better metod" ?
appaloosa
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 13 Feb 2011, 11:46

Re: bug in mod_phocagallery_image

Post by appaloosa »

Noone wants to solve this problem ??
rob-van-baal
Phoca Member
Phoca Member
Posts: 27
Joined: 14 Jan 2011, 21:15
Location: Netherlands
Contact:

Re: bug in mod_phocagallery_image

Post by rob-van-baal »

The "better" workaround (but still NO super solution) is to edit the file: /administrator/components/com_phocagallery/libraries/phocagallery/path/route.php

Then edit the three functions by putting in the fixed Itemid of PhocaGallery on your system (by me it is 113; can check that easy hoovering over a link within Phoca Gallery:

Code: Select all

function getCategoriesRoute() {
		$needles = array(
			'categories' => ''
		);
		
		// Current Itemid on the site
		// Can be a categories Itemid or category Itemid
		//$itemIdSite = JRequest::getVar('Itemid', 0, '', 'int')
		
		$link = 'index.php?option=com_phocagallery&view=categories';
		$link .= '&Itemid=113';
		return $link;
	}
	
	function getCategoryRoute($catid, $catidAlias = '') {
		$needles = array(
			'category' => (int) $catid,
			'categories' => ''
		);
		
		if ($catidAlias != '') {
			$catid = $catid . ':' . $catidAlias;
		}

		//Create the link
		$link = 'index.php?option=com_phocagallery&view=category&id='. $catid;
		$link .= '&Itemid=113';
		return $link;
	}
	


	function getImageRoute($id, $catid = 0, $idAlias = '', $catidAlias = '', $type = 'detail', $suffix = '')
	{
		$needles = array(
			'detail'  => (int) $id,
			'category' => (int) $catid,
			'categories' => ''
		);
		
		
		if ($idAlias != '') {
			$id = $id . ':' . $idAlias;
		}
		if ($catidAlias != '') {
			$catid = $catid . ':' . $catidAlias;
		}
		
		//Create the link
		
		switch ($type)
		{
			case 'detail';
				$link = 'index.php?option=com_phocagallery&view=detail&catid='. $catid .'&id='. $id;
				break;
			default;
				$link = '';
		}
		$link .= '&Itemid=113';
		
		if ($suffix != '') {
			$link .= '&'.$suffix;
		}

		return $link;
	}
The other coding in this file can be left as it is.

That's it. There is nothing more to say.
Post Reply