- Posts: 447
- Thank you received: 20
Images Displayed In Search Results
6 years 7 months ago #315186
by davec
Images Displayed In Search Results was created by davec
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
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
The following user(s) said Thank You: nicolas
Please Log in or Create an account to join the conversation.
6 years 7 months ago - 6 years 7 months ago #315594
by erickb
Replied by erickb on topic Images Displayed In Search Results
you can override /templates/YOUR_TPL/html/com_search/search/default_results.php
example result here sacapuce.fr/rechercher-chaussures-femmes...une&searchphrase=all
example result here sacapuce.fr/rechercher-chaussures-femmes...une&searchphrase=all
Code:
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: 6 years 7 months ago by erickb.
Please Log in or Create an account to join the conversation.
Time to create page: 0.233 seconds