3
votes

I´m using Joomla Smart Search in my website and I´m want to show intro-image and some extrafields from the article in the search results.

Joomla Smart Search removes any html tags and I want to prevent to do this extra fields

4

4 Answers

2
votes

in www\plugins\finder\content open content.php then search for getListQuery , at the end of ->select list add ->select('a.images AS image'); save & close the file

in www\components\com_finder\views\search\tmpl open default_result.php then search for class="result-title after the tag add these lines:

<?php $image=json_decode($this->result->image); ?>
<?php $aimage=$image->image_intro; ?>   
<div class="search-img">
<a href="<?php echo JRoute::_($route); ?>">
<img src="/<?php echo $aimage; ?>" >
</a>
</div>

save & close

dont forget to purge & reindex the smart search

1
votes

Smart search plugins say which fields should be indexed. You could replace some of the smart search plugins with ones of your own.

0
votes

I have found a solution, not absolutly like I wanted but it works. The solution shows the intro-text and all inside the "read more" of the article in the search results (images, links and everything you want).

This solution was found here http://forum.joomla.org/viewtopic.php?p=2324152 and says something like this:

"You'll need to create a layout override for the components/com_finder/views/search /tmpl/default_result.php layout file using the steps described at http://docs.joomla.org/Understanding_Output_Overrides Once you've created the layout override, you should change"

<?php echo JHtml::_('string.truncate', $this->result->description, $this->params->get('description_length', 255)); ?>

in the layout file to:

<?php echo $this->result->summary; ?>

The location should be templates/template_name/html/com_finder/search/default_result.php

0
votes

actually there is a very easy solution. K2 saves the images based on the md5 hash of the id.

adding this:

<div class="search-img">
<img src="<?php echo JURI::base().'media/k2/items/cache/'.md5("Image".$this->result->id).'_M.jpg'; ?>" />
</div>

to the html override of the default_result.php will display the according k2 items (here in medium resolution)