Jump to content

Calling category name in search results


jontyp

Recommended Posts

I am trying to call the category name in the search results to be displayed under the product name.

 

I can make this work in product-list.tpl simply by using

 

<p>Category:{$category->name|escape:'htmlall':'UTF-8'}</p>

 

This works perfectly. Search results use the product-list.tpl but the $category->name is not there any more to use

 

The problem is that i actually want it to display in the search results, and the variable is not there. I am thinking that controllers/searchcontroller.php is not calling the category information and so it will not work. Is this correct?

 

Does anyone know how to modify searchcontroller.php this to make sure that category name information is present and a useable variable in search results?

 

Using 1.4.8.2

 

Thanks in advance

Edited by jontyp (see edit history)
Link to comment
Share on other sites

Hi.

 

The category page displays information about the category, so the name is accessible, the search pulls the results from all the categories and displays only the matches.

 

You can add an extra left join to the search query to retrieve category names.

 

Regards.

 

Robin.

 

The CartExpert Team

Link to comment
Share on other sites

  • 2 months later...

Dear CartExpert.net,

 

what do you mean by saying:

You can add an extra left join to the search query to retrieve category names.
?

 

I need to display category name on productlist.tpl BUT it simply doesn't by using the code that jontyp kindly posted.

 

Maybe you have got the solution to this, it would be great!

 

Thanks. Luca.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...