- Posts: 3
COMMUNITY FORUM
K2 2.6.8 doesn't show images in search results
- eva
- Topic Author
- Offline
- New Member
Less
More
10 years 6 months ago #125951
by eva
K2 2.6.8 doesn't show images in search results was created by eva
Hello, I can't find solution, I'm using universal ajax live search to show results from K2, everithing work ok except showing little images in results. Settings looks OK. I thing that problem can be somewhere in plugin/search/K2/k2.php, becouse when I for example replace it with file from lower version (I think it's K2 2.5.7) it shows images, but results are wrong. I've tried k2.php from many versions but every has it's own bug. Please help.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 6 months ago #125952
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: K2 2.6.8 doesn't show images in search results
Hi. Universal AJAX live search is not part of K2. It's a third-party extension and you should ask it's developers for help.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- eva
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
10 years 6 months ago #125953
by eva
Replied by eva on topic Re: K2 2.6.8 doesn't show images in search results
Yes. it´s third-party extension but I saw similar problems with search images in lower versions of K2, in every cases was problem in plugin/search/K2/k2.php. AJAX live search work ok with ZOO and every other modules, so I really think that only one who can help me with this is K2 community. What I need is I think a short peace of code that will get image of item and put it in front of caption in search, but I can´t figure it how.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 6 months ago #125954
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: K2 2.6.8 doesn't show images in search results
K2 only provides default search functionality. What you call a "problem" might not be a problem actually. As is told you K2 provides search plugin which works with the core Joomla! search extension. A customization required by a third-party extension is not a "problem" and definitely the best thing you have to do is to ask the developers of this extension. Maybe they have already released a new version to work with K2.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- eva
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
10 years 6 months ago #125955
by eva
Replied by eva on topic Re: K2 2.6.8 doesn't show images in search results
I was right problem is in plugin/search/K2/k2.php according to file from lower version there are missing 2 lines:
We need to add
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg'))
$item->image = 'media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg';
just under:
$results = array();
if (count($rows))
{
foreach ($rows as $row)
{
$new_row = array();
foreach ($row as $key => $item)
{
and we had to add i.id, after SELECT in part:
$query = "
SELECT i.title AS title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
So it will look like this:
SELECT i.id, i.title AS title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
And that's all.. :ohmy:
We need to add
if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg'))
$item->image = 'media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg';
just under:
$results = array();
if (count($rows))
{
foreach ($rows as $row)
{
$new_row = array();
foreach ($row as $key => $item)
{
and we had to add i.id, after SELECT in part:
$query = "
SELECT i.title AS title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
So it will look like this:
SELECT i.id, i.title AS title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
And that's all.. :ohmy:
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 6 months ago #125956
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: K2 2.6.8 doesn't show images in search results
This code never existed in K2 search plugin. So probably you ( or whoever built the site ) hardcoded this code into the file. I suggest that you make this a different plugin otherwise you will lose your changes again in future updates.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.