Images Displayed In Search Results

  • Posts: 440
  • Thank you received: 20
  • Hikashop Essential
4 years 2 months 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: 2596
  • Thank you received: 62
  • Hikashop Business
4 years 2 months 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: 4 years 2 months ago by erickb.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum