Hi Xavier,
Got the image in, what I had forgotten to do is add the html to convert the url into an image link. So what I have done is modify the plugin and added the following code the the view, (added divs as well to help with styling):
<div class="nr-search">
<div class="nr-search-image">
<img src="<?php echo $result->image; ?>" width="150" alt="Not Just Nappies">
</div>
<div class="nr-search-desc">
<dt class="result-title">
<?php echo $this->pagination->limitstart + $result->count.'. ';?>
<?php if ($result->href) :?>
<a href="<?php echo JRoute::_($result->href); ?>"<?php if ($result->browsernav == 1) :?> target="_blank"<?php endif;?>>
<?php echo $this->escape($result->title);?>
</a>
<?php else:?>
<?php echo $this->escape($result->title);?>
<?php endif; ?>
</dt>
<?php if ($result->section) : ?>
<dd class="result-category">
<span class="small<?php echo $this->pageclass_sfx; ?>">
(<?php echo $this->escape($result->section); ?>)
</span>
</dd>
<?php endif; ?>
<dd class="result-text">
<?php echo $result->text; ?>
</dd>
<dd class="result-price">
<?php echo $result->price; ?>
</dd>
<?php if ($this->params->get('show_date')) : ?>
<dd class="result-created<?php echo $this->pageclass_sfx; ?>">
<?php echo JText::sprintf('JGLOBAL_CREATED_DATE_ON', $result->created); ?>
</dd>
<?php endif; ?>
</div>
</div>
I modified the hikashop_products.php file (thanks to a free plugin by the guys at
offlajn.com/
):
$query = ' SELECT DISTINCT '.$select.', f.file_path AS product_image FROM '.hikashop_table($trans_table,false) . ' AS b LEFT JOIN '.hikashop_table('product').' AS a ON b.reference_id=a.product_id INNER JOIN '.hikashop_table('file').' AS f ON f.file_ref_id=a.product_id WHERE '.implode(' AND ',$filters2).' AND f.file_type="product" ORDER BY '.$order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList("id");
$count = count($rows);
if($count){
$limit = $limit-$count;
$filters[]='a.product_id NOT IN ('.implode(',',array_keys($rows)).')';
}
}
if($limit){
if(!empty($leftjoin)){
$select.=', b.category_id as category_id';
}
$db->setQuery('SET SQL_BIG_SELECTS=1');
$db->query();
$query = ' SELECT DISTINCT '.$select.', f.file_path AS product_image FROM '.hikashop_table('product') . ' AS a '.$leftjoin.' LEFT JOIN '.hikashop_table('file').' AS f ON f.file_ref_id=a.product_id WHERE '.implode(' AND ',$filters).' GROUP BY (a.product_id) ORDER BY '.$order;
$db->setQuery( $query, 0, $limit );
$mainRows = $db->loadObjectList("id");
if(!empty($mainRows)){
foreach($mainRows as $k => $main){
$rows[$k]=$main;
}
$count = count( $rows );
}
}
if($count){
if($multi && !empty($lg)){
$query = ' SELECT * FROM '.hikashop_table($trans_table,false) . ' WHERE reference_table=\'hikashop_product\' AND language_id=\''.$lg.'\' AND published=1 AND reference_id IN ('.implode(',',array_keys($rows)).')';
$db->setQuery($query);
$trans = $db->loadObjectList();
foreach($trans as $item){
foreach($rows as $key => $row){
if($row->id==$item->reference_id){
if($item->reference_field=='product_name'){
$row->product_name=$item->value;
}elseif($item->reference_field=='product_description'){
$row->product_description=$item->value;
}else{
$row->product_name=$item->value;
}
break;
}
}
}
}
$parent = '';
$item_id = $this->params->get('item_id','');
$menuClass = hikashop_get('class.menus');
$config =& hikashop_config();
$pathway_sef_name = $config->get('pathway_sef_name','category_pathway');
$menus=array();
$Itemid='';
if(!empty($item_id)){
$Itemid='&Itemid='.$item_id;
if($this->params->get('full_path',1)){
$menuData = $menus[$item_id] = $menuClass->get($item_id);
if(!empty($menuData->hikashop_params['selectparentlisting'])){
$parent = '&'.$pathway_sef_name.'='.(int)$menuData->hikashop_params['selectparentlisting'];
}
}
}
$itemids=array();
$app= JFactory::getApplication();
$class = hikashop_get('class.product');
foreach ( $rows as $k => $row ) {
if(!empty($row->category_id)){
if(empty($item_id)){
if(!isset($itemids[$row->category_id])) $itemids[$row->category_id] = $menuClass->getItemidFromCategory($row->category_id);
$item_id = $itemids[$row->category_id];
}
if(!empty($item_id)){
$Itemid='&Itemid='.$item_id;
}
if($this->params->get('full_path',1)){
$parent = '&'.$pathway_sef_name.'='.(int)$row->category_id;
}
if(!$this->params->get('item_id','')) $item_id = '';
}
$class->addAlias($row);
$row->title=$row->product_name;
$row->text=$row->product_description;
if($variants && $row->product_type=='variant'){
static $mains = array();
if(!isset($mains[$row->product_parent_id])){
$mains[$row->product_parent_id] = $class->get((int)$row->product_parent_id);
$class->addAlias($mains[$row->product_parent_id]);
}
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM '.hikashop_table('variant').' AS a LEFT JOIN '.hikashop_table('characteristic') .' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE a.variant_product_id='.(int)$row->id.' ORDER BY a.ordering');
$row->characteristics = $db->loadObjectList();
$class->checkVariant($row,$mains[$row->product_parent_id]);
if(empty($row->title)){
$row->title = $row->product_name;
}
if(empty($row->text)){
$row->text = $mains[$row->product_parent_id]->product_description;
}
}
$rows[$k]->href = 'index.php?option=com_hikashop&ctrl=product&task=show&name='.$row->alias.'&cid='.$row->id.$Itemid.$parent;
$rows[$k]->section = JText::_( 'PRODUCT' );
$rows[$k]->price = $this->getPrice($row->id);
if ($row->product_image) {
$rows[$k]->image = JUri::Root().'media/com_hikashop/upload/'.$row->product_image;
}
}
}
return $rows;
}
function getPrice($pid) {
$arr = array();
$arr[0] = new stdClass();
$arr[0]->product_id = $pid;
$currency = hikashop_get('type.currency');
$currencyClass = hikashop_get('class.currency');
$zone = hikashop_getZone();
$cur = hikashop_getCurrency();
$currencyClass->getListingPrices($arr,$zone,$cur);
return $currencyClass->format($arr[0]->prices[0]->price_value, $cur);
}
}
What I am missing to how to display the price_value_with_tax field (price including tax)