1

I want to add the articles category name, when the results show up for "Smart search" plugin. right now it only shows the article name. i tried to use this code, but it didn't work:

<?php $title = $this->escape($item->category_title); ?>
                            <?php if ($params->get('link_category') && $item->catslug) : ?>
                                <?php $url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>

Can anyone tell me if there are any other way to do it? :)

  • Do you mean to show the article's category name on the search results page of the Smart Search component? Anyhow, I don't think this is supported with the current Smart Search system, but maybe I am wrong. – FFrewin Nov 1 '15 at 22:58
  • yes thats what i mean. i know its not supported ,but there may be a small code to write to implement it? – Peter Nov 2 '15 at 14:27
1

I don't think this supported with the current Smart Search system. With non supported, I mean that there won't be a quick and easy way to do this.

I haven't dig deep into the Smart Search, so maybe I am wrong. But as far as I know, Results for Search Keywords of the smart search, are stored and indexed in a special table of the db.
Smart Search at the moment only stores essential data, like terms and their associative links. This allows a quick and flexible search against them.

There is No additional information like the category for an article to return after a search, so apparently there is not a small piece of code to copy/paste, to achieve what you want.

You would have to create additional complex queries for each of the results, among other development.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.