Images Displayed In Search Results

  • Posts: 265
  • Thank you received: 13
  • Hikashop Business
2 months 22 hours ago #315186

Hi

I noticed one or two posts that were asking for images in the search results. I have managed to achieve this with a template override. You will need to unzip the attached file and place it in the HTML folder of your template. This is a Joomla override not Hikashop. The instructions I used were here www.phoca.cz/documents/15-phoca-gallery-...oomla-search-results

Dave B)

Attachments:
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

  • Posts: 2358
  • Thank you received: 54
  • Hikashop Business
1 month 2 weeks ago #315594

you can override /templates/YOUR_TPL/html/com_search/search/default_results.php

example result here sacapuce.fr/rechercher-chaussures-femmes...une&searchphrase=all

defined('_JEXEC') or die;
$link = $name =  null;
$sef = JFactory::getConfig()->get('sef') ;
$hk_link = 'index.php?option=com_hikashop&ctrl=product&task=show&cid=';
?>
<section class="search-results">
<?php foreach ($this->results as $result) { 
if(!empty($result->image)){	
	if($sef==1)	{
		$link = JRoute::_($result->href); 
	} 
	else{
		$link = JRoute::_($hk_link . $result->id . '&name=' . $result->product_alias);  
	}
		$name = explode (' ',$result->product_name);
				$i = 0;
				
?>
<div class="search-result hk-products">
<h4 class="hk-product-name"><a href="<?php echo $link; ?>"><?php foreach($name as $n){
					$i++;
					if($i==1){
						echo '<span class="hk-product-name-main">' .$n. '</span>'; 
					} else{
						echo  $n . ' ' ; 
					}
				} ?></a></h4>

<figure class="hk-product-img">
			<a href="<?php echo $link; ?>">
<img class="hk-product-thumb" src="<?php echo $result->image; ?>" />
			</a>
	</figure>
</div>
<?php } 
}
?>
</section>

Last edit: 1 month 2 weeks ago by erickb.

Please Log in or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum