Keyword

Images in search results

  • Mark Foster
  • Mark Foster's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 4 months ago #93509 by Mark Foster
Images in search results was created by Mark Foster
Been googling for ages to try and find something

Is there any way or hack that I can implement so that images can be shown in search results

 

It's critical for a properties site that I am making

 

Please help!

 

Kind regards

 

Mark

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

More
14 years 4 months ago #93510 by BBC
Replied by BBC on topic Images in search results
mod_k2_tools, set "Search" and try to style it as you want.

 

How many columns do you want ? Intro, just Title ? Something else ?

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

  • Mark Foster
  • Mark Foster's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 4 months ago #93511 by Mark Foster
Replied by Mark Foster on topic Images in search results
Hi, thanks for reply

Sorry I should said, I'm using the extra fields search from Joomlart as I need to to be able to offer drop down choices as well otherwise I would have used the k2 tools one

 

Site is here

www.farmhousesaleslemarcheitaly.co.uk/

If you set province in the search to Fermo, then 2 results are returned, I need to be able to display the images next to them.

 

Mamy thanks

 

Mark

 

 

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

More
14 years 4 months ago #93512 by BBC
Replied by BBC on topic Images in search results
Do you testing something ?

There are some image frames.

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

  • Mark Foster
  • Mark Foster's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 4 months ago #93513 by Mark Foster
Replied by Mark Foster on topic Images in search results
Yeah I tried a hack from the joomlart forums.

Which modded the default_results.php file in com_search and added this

 

<img src="<?php echo $result->image; ?>" alt="<?php echo $result->title; ?>" title="<?php echo $result->title;?>" width="100px" height="100px"/>

the result class is empty though and isn't returning an image though

I guess this is all means getting further into how K2 and the standard Joomla search work together

Thanks

 

Mark

 

 

BBC said:

Do you testing something ?

There are some image frames.

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

More
14 years 4 months ago #93514 by BBC
Replied by BBC on topic Images in search results
As i see it in K2 settings, images in search listings are supported.

 

Fast, not as you want it, in Joomla com_search.

 

But, i cannot get images to show in search listing.

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

More
14 years 3 months ago #93515 by jjozsika
Replied by jjozsika on topic Images in search results
Hello! i've found a solution:

 

You have the search mod which is searching in the table.

Located:  plugins/search/jak2_filter.php

It has the SQL query with binary search, you have to add the id field to the selected list:

In the 231. line oyou have to add the id field name:

$query = "            SELECT i.id,            i.title,            i.metadesc,

 

 


Now, you can go and edit the result lister tamplate:

/templates/gk_mystore/html/com_search/search/default_results.php

After the result cycle,

<?php foreach ($this->results as $result) : ?>

You can add the image generation based pn the id and md5() hash:

<?php            $row = './media/k2/items/cache/'.md5("Image".$result->id).'_S.jpg';            if(file_exists($row))            echo "<img src=\"$row\">";?>

 

And woala, the images right there!

 

regards, jjozsi

 

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

  • Mark Foster
  • Mark Foster's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 3 months ago #93516 by Mark Foster
Replied by Mark Foster on topic Images in search results
Will try that now and let you know!

 

Thanks

 

Mark

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

More
14 years 3 months ago #93517 by jjozsika
Replied by jjozsika on topic Images in search results
Make some backups of your files :)

Mark Foster said:
Will try that now and let you know!

 

Thanks

 

Mark

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

  • Mark Foster
  • Mark Foster's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 3 months ago #93518 by Mark Foster
Replied by Mark Foster on topic Images in search results
You are a star :)

 

Works great, been waiting weeks to find a solution to that :)

 

Thank you so much

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

More
14 years 3 months ago #93519 by jjozsika
Replied by jjozsika on topic Images in search results
Your Welcome :)

Mark Foster said:
You are a star :)

 

Works great, been waiting weeks to find a solution to that :)

 

Thank you so much

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

More
14 years 3 months ago #93520 by Emily Pearce
Replied by Emily Pearce on topic Images in search results
Thanks so much for this solution...working perfectly :)

I would also like to include an items extra fields in the Joomla search results.

Any idea how i might do this?

Many thanks, Emily

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

More
14 years 3 months ago #93521 by jjozsika
Replied by jjozsika on topic Images in search results
You saw where i added the extra field to the main query. There you can prepare extra variables. (i had to add the images to the results only).

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

More
14 years 2 months ago #93522 by Liam McGarry
Replied by Liam McGarry on topic Images in search results
Hi There,

 

I've signed up to say a massive thank you to jjozsika who solved the exact same problem that I had!

 

For anyone who may be stuggling to find the default_results.php file, it can be found in different locations, mine was:

 

components/com_search/views/search/tmpl

 

Also, whilst on the topic of searching, does anyone know how to modify the search results screen?

 

I.e Remove:

 

Search Keyword:         SearchAll words Any words Exact PhraseSearch Only:Activities Other group



I too am using K2 search filter

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

  • Francisco Ferreira
  • Francisco Ferreira's Avatar
  • Offline
  • Junior Member
More
14 years 4 days ago #93523 by Francisco Ferreira
Replied by Francisco Ferreira on topic Images in search results
Ok,

 

Many thanks jjozika.

 

We now know how to put images on search results. Nonetheless It would be the ultimate help if you or someone could explain us newbies how to do the same with other extra fields, i.e. I understand we just need to put the field name like: $query = "            SELECT i.id,            i.title,            i.metadesc,

... but I'm not so clear about what to put on the default_results.php ? 

 

Can you help us please?

 

Many thanks in advance...

 

Francis

 

ps: Why would JA guys make the dificult part only to en up before developing the easyer part, i.e. costumizable results display... 

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

More
13 years 11 months ago #93524 by Brenda
Replied by Brenda on topic Images in search results
How do you add images to search if you are just using K2 Tools Search and not Joomlart?

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

More
13 years 11 months ago #93525 by Brenda
Replied by Brenda on topic Images in search results
Nevermind, I figured it out:

In this file:  /plugins/search/k2.php

add the id to the SELECT query (It has the SQL query with binary search, you have to add the id field to the selected list:

add the id field name):

$query = "             SELECT i.id,             i.title,             i.metadesc,

 

In this file:  /components/com_search/views/search/tmpl/default_results.php

AFTER THIS SECTION(or where you want to position the image) :

if ( $result->section ) : ?><br /><span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">(<?php echo $this->escape($result->section); ?>)</span><?php endif; ?><?php endif; ?></div>

 

ADD THIS:

<?php             $row = './media/k2/items/cache/'.md5("Image".$result->id).'_S.jpg';             if(file_exists($row))             echo "<img src=\"$row\">"; ?>

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

More
13 years 11 months ago #93526 by Jock
Replied by Jock on topic Images in search results
Hi,

 

This is kind of related but not entirely the same ... does anyone know how you return $result->text; for extra fields? Basically I want my search results to have the snippet of text with the highlighted keywords for content that is in extra fields. Currently it is returning the matching item but not with the snippet.

 

Anyone know how to fix this?

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

More
13 years 10 months ago #93527 by Sotiris
Replied by Sotiris on topic Images in search results
and i try to find how i can show extra fields value in search result...

 

Anyone know how i can do it?

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

More
13 years 10 months ago #93528 by Jock
Replied by Jock on topic Images in search results
I am struggling to find a solution Sotrek. Really not sure why it wouldn't work when it returns the item but no snippet?

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


Powered by Kunena Forum