Keyword

Displaying author in smart search results

  • Tyler Ancell
  • Tyler Ancell's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 11 months ago #144317 by Tyler Ancell
Displaying author in smart search results was created by Tyler Ancell
Hi there,

I'm trying to figure out if it's possible to add the author to the smart search results - pretty much at a complete loss here. I've tried looking at the k2 finder plugin and the com_finder -> search_result.php, but since I'm relatively new to php, I'm not quite sure how the plugin interacts with the joomla component.

Is there any easy way to accomplish this?

Thanks in advance.

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

  • Tyler Ancell
  • Tyler Ancell's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 11 months ago #144318 by Tyler Ancell
Replied by Tyler Ancell on topic Displaying author in smart search results
Well, apparently I figured it out.

Make an override for com_finder:

1) Locate the "default_result.php" in "\components\com_finder\views\search\tmpl" and copy that file to "\templates\[YOUR TEMPLATE]\html\com_finder\search"

2) Here you can add strings like $this->result->category or $this->result->author, etc

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

  • Tyler Ancell
  • Tyler Ancell's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 11 months ago #144319 by Tyler Ancell
Replied by Tyler Ancell on topic Displaying author in smart search results
Basically, if you look in "/plugins/finder/k2/k2.php" and find this function: "protected function getListQuery($sql = null)" you can find pretty much anything you'd like to add, for example:

If I wanted to add the created date, I would look for this line (the bolded part):
$sql->select('a.published as state, a.catid, a.created AS start_date, a.created_by');

Then I could edit default_result.php and add something like this:
<div class="date_created">
<p>Created on <?php echo JHTML::_('date',$this->result->start_date, JText::_('K2_DATE_FORMAT_LC_2')); ?></p>
</div>

Hope that helps anyone that has having a similar issue.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #144326 by Krikor Boghossian
Replied by Krikor Boghossian on topic Displaying author in smart search results
Awesome!
Thanks for sharing this Tyler :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum