Product Picture in Search Results

  • Posts: 4
  • Thank you received: 0
13 years 1 week ago #11250

Is it possible to do a search that only retrieves hikashop products and populates the search results with a thumbnail image and title for said products?

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
13 years 1 week ago #11252

You can have a search that only retrieves the hikashop products. Just unpublish the other joomla search plugins in the joomla plugin manager.

You cannot have images in the search results unless you edit both the code of the hikashop product search plugin and the search results view to add that functionality.

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

  • Posts: 4
  • Thank you received: 0
13 years 1 week ago #11313

I would be willing to edit that code, is it something difficult to do? also, is it code that has to be edited per product item, or just twice? can you help direct me on where I need to edit this code exactly and what I need to edit it to? Also, I would ideally like to have an "Add to Cart" button appear with each product in the search result, as well as on each product page.

Sorry, just learning Joomla right now, so I am extremely ignorant when it comes to some things that are most likely very obvious.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
13 years 1 week ago #11316

If you don't know how to do it, that means that it will be difficult for you to do those changes. You would have first to load the images data of the results in the hikashop product search plugin and then add the HTML code to display the image in the view file of the search component of joomla.
We can't give you more advice than this. This is a support forum, not a customization forum. If you want us to do it for you, you can contact us via our contact form and we will give you a quote.

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

  • Posts: 17
  • Thank you received: 6
9 years 8 months ago #164811

These are the modifications I have made on one of our site. I hope it will be helpful for some of you:

In /plugins/search/hikashop_products/hikashop_product.php
Line: 117

$leftjoin=' INNER JOIN '.hikashop_table('product_category').' AS b ON a.product_id=b.product_id
			LEFT JOIN '.hikashop_table('file').' as f ON a.product_id = f.file_ref_id';

Here I query the images as well.

Then I had template overrides for the search already, so in
/templates/html/com_search/search/default_results.php
around Line: 28

<?php
if($result->path)
{
	?>
		<span class="search_img">
	
		<img
		<?php
		$link=JURI::root().'media/com_hikashop/upload/'.$result->path; 
	
		?>

	title="<?php echo $result->filedesc; ?>" src="<?php echo $link ?>" alt="<?php echo $result->filename; ?>" width="150" />
		</span>
		<?php
}
		?>

Here I have placed the image in the search result. Then it has to be styled in css.
I do not guarantee that it is compatible with hikashop, and apologize for that, it just worked for me with the settings I have done in the webshop.


Web developer at Ketsh Web
www.ketsh.hu
The following user(s) said Thank You: sax, Mohamed Thelji, conticreative

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

  • Posts: 196
  • Thank you received: 5
9 years 7 months ago #165749

Hi, is there a chance you could document this change (especially the one in /plugins/search/hikashop_products/hikashop_product.php) with the actual current code and your change?
My line numbers bust be completely screwed up. I found a similar area, but I am not quite sure if it is correct and what I should do with it.

if($variants){
			$leftjoin=' INNER JOIN '.hikashop_table('product_category').' AS b ON a.product_parent_id=b.product_id OR a.product_id=b.product_id';
		}else{
			$leftjoin=' INNER JOIN '.hikashop_table('product_category').' AS b ON a.product_id=b.product_id';
		}

Honestly, I am a bit baffled by the code in /templates/[my_template]/html/com_search/search/default_results.php

I don't understand where those valuables are getting their values, but that could stem by having the other code in the wrong place.

Thank you.

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

  • Posts: 17
  • Thank you received: 6
9 years 7 months ago #165755

I have attached the files I have modified.


Web developer at Ketsh Web
www.ketsh.hu
Attachments:

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

  • Posts: 196
  • Thank you received: 5
9 years 7 months ago #165802

Thank you. You are an angel. I'll let you know how it works.

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

  • Posts: 196
  • Thank you received: 5
9 years 7 months ago #165818

First of all, I realize you are busy and I don't want you to waste too much time on this. Please reply only if you really want to.

Unfortunately, it appears that my default_results.php override is radically different from yours.
So I ended up using your code snippet from the forum and using the default Joomla default_results.php from com_search instead of the override in my template and that worked out better. It's more similar to your example.

At the same time, I am not getting any images in the results and in playing with the code I realized that none of the variable in your code here:

<?php  if($result->path) { ?>
		<span class="search_img">
		<img <?php $link=JURI::root().'media/com_hikashop/upload/'.$result->path;  ?>
		 title="<?php echo $result->filedesc; ?>" 
         src="<?php echo $link ?>" 
         alt="<?php echo $result->filename; ?>" 
         width="150" />
		</span>
		<?php } ?>

Have a value. Mainly I think I am missing $result->path because it looks like it sets the rest of the variable in the image.
I have tried to echo each of those variable individually but all I get are blanks.

1) Could be that I am supposed to turn something on in the search plugin that will provide a value for the images from the DB?
2) Is it possible that in your override there is some code that already establishes those variables (and missing that, I get empty fields?)
3) or it could be I am just a moron, in which case eventually I'll figure it out.

Again, feel free to leave it at this if it's too much work for you. Eventually I'll figure it out. I feel I am really close.

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

  • Posts: 17
  • Thank you received: 6
9 years 7 months ago #165967

Hi, Sorry, I have forgotten that I had made 2 changes in
/plugin/search/hikashop_products/hikashop_products.php

Firt: line117:

$leftjoin=' INNER JOIN '.hikashop_table('product_category').' AS b ON a.product_id=b.product_id
			LEFT JOIN '.hikashop_table('file').' as f ON a.product_id = f.file_ref_id';

I have joined the table.

Second:
line:183:
$select = ' a.product_id AS id, a.product_name, a.product_created AS created , a.product_description, "'.$new_page.'" AS 
		browsernav, f.file_path AS path, f.file_description as filedesc, f.file_name AS filename';

Added the 3 additional fields: file_path, file_description, file_name.
Hope it helps.


Web developer at Ketsh Web
www.ketsh.hu
The following user(s) said Thank You: Alexandre, hactic

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

  • Posts: 10
  • Thank you received: 0
9 years 2 months ago #188112

hi

we have try to Product Picture in Search Results ( joomla default search page.)

please check my website nflmerch. com

can you please help me ?

Thanks
Deepz

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
9 years 2 months ago #188132

Hi,

Alternatively, you can use the filters system of HikaShop instead of the search system of Joomla for your products search. The filters system supports the display of products images in the results:
www.hikashop.com/support/support/documen...-filter-listing.html

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

  • Posts: 10
  • Thank you received: 0
9 years 2 months ago #188161

thanks for your reply.

What i want ?

please check this screen shots. And please help me.

waiting for your biggest Help.

Thanks
Vinu

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
9 years 2 months ago #188188

Hi,

In the search plugin you have to get the product images, you can see how it is working in the view "product / show_block_img".
You will potentially have to get the full product php object before looking for its attached images.

/* You will potentially have to use two different codes, one for the products and one for the categories */
$ids = array(); // fill it with the ids of the products returned in the search
$imgAddress = array();
$imageHelper = hikashop_get('helper.image');
$productClass = hikashop_get('class.hikashop');
$productsData = $productClass->get($ids);
foreach($productsData as $product){
  $image = reset($product->images);
  $imgAddress[$id] = '/mainPath/'.$image->file_path;
}

And then for each results get the image path from the previously created array.

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

  • Posts: 10
  • Thank you received: 0
9 years 2 months ago #188284

where can i add this code ?

i don't know coding.

Please help me.

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

  • Posts: 10
  • Thank you received: 0
9 years 2 months ago #188287

which place i will add this code ?

it's for /templates/template/html/com_search/search/ default_results.php file.

please help me

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.3.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<dl class="search-results<?php echo $this->pageclass_sfx; ?>">
<?php foreach ($this->results as $result) : ?>

<!--Dave's code for IMAGES
    <?php echo '<div style="float: left;margin: 5px 10px;"><img src="'. $this->escape($result->image).'" alt="" /></div>';?>
end Dave's code -->
<dt class="result-title">
		<?php echo $this->pagination->limitstart + $result->count.'. ';?>
<img src="<?php echo JRoute::_($result->image); ?>"> 


		<?php if ($result->href) :?>
			<a href="<?php echo JRoute::_($result->href); ?>">
				<?php echo $this->escape($result->title);?>
			</a>
		<?php else:?>
			<?php echo $this->escape($result->title);?>
		<?php endif; ?>
	</dt>
	<!--Dave commented out
	</*?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; ?*/>
	end dave comment out-->
	
	<dd class="result-text">
		<?php echo $result->text; ?>
	</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; ?>
	
<!--Dave's code for IMAGES
    <?php echo '<div style="clear:both"></div>'; ?>
	end Dave's code-->

<br>
<?php endforeach; ?>
</dl>

<div class="pagination">
	<?php echo $this->pagination->getPagesLinks(); ?>
</div>

Last edit: 9 years 2 months ago by Xavier. Reason: Use of [code]...[/code] tags

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

  • Posts: 13201
  • Thank you received: 2322
9 years 2 months ago #188305

Hi,

The given code is not complete, it require more elements, more php loops etc.
So if you are not a developer we recommend to:
- Use the default search
- Use the hikashop filters instead of the search
- Post a request on the commercial jobs section of this forum
- Ask to a third developer

The following user(s) said Thank You: vinu

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

  • Posts: 10
  • Thank you received: 0
9 years 2 months ago #188385

thanks for your reply.

Once you check this link

www.nflmerch.com/component/search/?searc...hrase=all&Itemid=103

we have using default search (joomla)

But i want show product images or thumbs

can you help me ?

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
9 years 2 months ago #188457

The default search of Joomla doesn't support images display.
If you need that and you're not a developer and you don't want to pay one for that customization, you're left with two options:
1. You use the HikaShop filter system which can do that.
2. You try to find another search extension which is compatible with HikaShop and which supports the images display.

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

  • Posts: 10
  • Thank you received: 0
9 years 2 months ago #188466

Thanks for your reply

can you please tell me

have any another search extension which is compatible with HikaShop and which supports the images display ?

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

Time to create page: 0.140 seconds
Powered by Kunena Forum