I have been trying to track down a solution that will return a link to the images that the search encounters, not the category. There seems to have been some talk about this issue, with perhaps solutions offered for prior versions of the plugin. Can anybody point me to a solution, since for my site good search results - pointing to exact images - is critical.
Thankx
Search Plugin Results - 2.7.1
-
- Phoca Newbie
- Posts: 3
- Joined: 30 May 2010, 22:47
Re: Search Plugin Results - 2.7.1
On further looking in the .../search/phocagallery.php script the results for both the CATEGORIES and the IMAGES are returned using a function - getCategoryRoute. Perhaps by using a different function - getImageRoute - the string returned would be for the image and not the category?
Does this make any sense? If so can anybody tell me where I can find the correct parameters to pass to this function?
Thanks again;
Does this make any sense? If so can anybody tell me where I can find the correct parameters to pass to this function?
Thanks again;
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Search Plugin Results - 2.7.1
Hi, this is because there is no direct link to detail window (popup), both are called with other parameters:
getCategoryRoute($value->catid, $value->catalias)
x
getCategoryRoute($value->id, $value->alias)
It is only about finding Itemid, for displaying directly the popup window (modal, ...) you need to load all the javascript libraries to the search outcomes file.
Jan
getCategoryRoute($value->catid, $value->catalias)
x
getCategoryRoute($value->id, $value->alias)
It is only about finding Itemid, for displaying directly the popup window (modal, ...) you need to load all the javascript libraries to the search outcomes file.
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 30 May 2010, 22:47
Re: Search Plugin Results - 2.7.1
Jan;
I'm not sure I really understand all the details, but I made the following change in /plugins/search/phocagallery.php:
Line 156 was:
$listImages[$key]->href = JRoute::_(PhocaGalleryRoute::getCategoryRoute($value->catid, $value->catalias));
I changed it to:
$listImages[$key]->href = JRoute::_(PhocaGalleryRoute::getImageRoute($value->id, $value->catid, $value->alias, $value->catalias, 'detail', $suffix ));
After this change clicking on the search result brought up the image found in the search which is what I want.
It comes in a slide show window which may not be the best result, but I am going to continue along this path and see where it leads.
Max
I'm not sure I really understand all the details, but I made the following change in /plugins/search/phocagallery.php:
Line 156 was:
$listImages[$key]->href = JRoute::_(PhocaGalleryRoute::getCategoryRoute($value->catid, $value->catalias));
I changed it to:
$listImages[$key]->href = JRoute::_(PhocaGalleryRoute::getImageRoute($value->id, $value->catid, $value->alias, $value->catalias, 'detail', $suffix ));
After this change clicking on the search result brought up the image found in the search which is what I want.
It comes in a slide show window which may not be the best result, but I am going to continue along this path and see where it leads.
Max
-
- Phoca Enthusiast
- Posts: 78
- Joined: 28 Feb 2010, 15:39
Re: Search Plugin Results - 2.7.1
This may be a solution for you, although it may also be a little different than your target resolution. Nonetheless, if you are trying to get away from a modal popup, but want to be certain that a user is taken to a category page that includes the search result image, you can update the images SQL query in the phocagallery.php file from the search plugin (version 2.7.1) to pull the 'ordering' column, then append '&limitstart='.$ordering to the end of the href value. The updated link will load the correct page of the category.
Or, in code-speak -
Update this line of the images query:
To read:
Update the foreach loop that traverses the $listImages dataset, adding this within the loop:
This will still make your result item link to the category, but it guarantees that multi-page categories will be on the page including the target image.
I usually use this update to control the textual link. To supplement this update, I retrieve more alias values in the SQL query and update the com_search component's default_results.php file to show the thumbnail for the result. When clicking the thumbnail, I popup the modal slideshow starting at that image. This way, if the user wants to see the full image they are able, but if they simply click the link, they will proceed to the category (which, in theory, has more images like that result...), and they will have seen the thumbnail for the search result.
Or, in code-speak -
Update this line of the images query:
Code: Select all
. ' "2" AS browsernav, b.id as catid, b.alias as catalias'
Code: Select all
. ' "2" AS browsernav, b.id as catid, b.alias as catalias, a.ordering AS photoordering'
Code: Select all
//If SEF URLs ARE NOT enabled:
$listImages[$key]->href.='&limitstart='.($listImages[$key]->photoordering-1);
//If SEF URLs ARE enabled:
//$listImages[$key]->href.='?start='.($listImages[$key]->photoordering-1);
This will still make your result item link to the category, but it guarantees that multi-page categories will be on the page including the target image.
I usually use this update to control the textual link. To supplement this update, I retrieve more alias values in the SQL query and update the com_search component's default_results.php file to show the thumbnail for the result. When clicking the thumbnail, I popup the modal slideshow starting at that image. This way, if the user wants to see the full image they are able, but if they simply click the link, they will proceed to the category (which, in theory, has more images like that result...), and they will have seen the thumbnail for the search result.
-
- Phoca Member
- Posts: 24
- Joined: 28 Jul 2009, 03:41
Re: Search Plugin Results - 2.7.1
bedachtm wrote:Jan;
I'm not sure I really understand all the details, but I made the following change in /plugins/search/phocagallery.php:
Line 156 was:
$listImages[$key]->href = JRoute::_(PhocaGalleryRoute::getCategoryRoute($value->catid, $value->catalias));
I changed it to:
$listImages[$key]->href = JRoute::_(PhocaGalleryRoute::getImageRoute($value->id, $value->catid, $value->alias, $value->catalias, 'detail', $suffix ));
After this change clicking on the search result brought up the image found in the search which is what I want.
It comes in a slide show window which may not be the best result, but I am going to continue along this path and see where it leads.
Max
I tried this solution, but it is not very elegant. Clicking the search result brings me to a partial page that has my header, top nav, and the photo in question, but other items are missing from the page (the background image, footer navigation, etc).
Is there a way to modify this code so that the lightbox version of the image will pop open while the browser remains on the search results page where they clicked the link?
Thanks!