Jump to content

how to display Category links with search results?


rhath127

Recommended Posts

hey all, Is there a way to display the the left side category links as part of the search results? 

ie: I have searched for a product and there are results, but I would like to show the category links on the left.

I haven't been able to figure this out.

Link to comment
Share on other sites

  On 3/28/2025 at 1:07 AM, juanrojas said:

Hi, I'm not sure if I understood your request completely, but have you taken a look at the Category Tree Links module to see if it's what you're looking for?

Expand  

Hi, when I click on products - see the categories appear on the left side. But when I search for an item, nothing is on the left. Is there a way to put the categories to appear on the left when a search is done? Please refer to image

displ1.jpg

displ2.jpg

Link to comment
Share on other sites

Hi.

The left category block is displayed assuming that the parent category id or the default category id in the product detail is available. The search page does not know the category id, so the left block is not displayed. It is not that easy a task as you request, you would have to create an extra module that would display the default category of the searched product in the left column. However, it would be quite simple to display a button under the price for each product in the list, for example (Show category).

e.g. button in TPL

./themes/classic/templates/catalog/_partials/miniatures/product.tpl

{if isset($page.page_name) && $page.page_name == 'search'}
    <a href="{url entity='category' id=$product.id_category_default id_lang=$language.id}" class="btn btn-default">Go to category</a>
    {/if}

 

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

  On 3/28/2025 at 4:32 AM, dinesh badrukhiya said:

Check Template Layout File:

Look into your layout files like layouts/layout-both-columns.tpl

Your search page might be using a layout like layout-full-width.tpl (which has no sidebar).

Change it to a layout with a left column.

Expand  

Hi.

What you advise can be done in the template administration Design -> Theme & Logo At the very bottom is the Choose Layouts option. In the list you can find Search and change it to two columns. But you will only see one category "Home" 😉 

Screenshot_20250328_062800.thumb.jpg.4a24f74d485c30250760ae46dabb5ee7.jpg

Edited by ps8modules
added screenshot (see edit history)
Link to comment
Share on other sites

You need to modify the code of the ps_categorytree module.  

You need to modify the getWidgetVariables function, that have a condition to display the category tree only on the category pages. 

image.thumb.png.0e14c213bc83a8b1ea2c9487104de45b.png

You can add a condition of the search controller and then set the category id to 0 to show the complete tree.

 

Note: Clicking on the category tree, will take the user to the category page; No relation between the category tree and the search results. You need to code future if you are looking for search result filter etc.

 

 

 

 

 

Link to comment
Share on other sites

This 2nd issue, is a bit of a visual issue than a fucntional one.

I downloaded the Tophorizontalmenu module and installed it, it works but I would like to change the so its not all uppercase and the drop down to show in alphabetical order.

Pic for reference

menu1.jpg

menu2.jpg

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...