How to change ‘Categories’ label to ‘Product List’ p.e (in layered navigation)

Hi @digitalstartup First of all massive thank you for all your help every time I approached you with a question - always there and always helpful!

I came across another one that I couldn’t find solution for myself after researching on how to change the ‘categories’ label which appears in sidebars(layered navigation). I have tried via ‘Translate line’ and also turned on the file path hints for storefront hoping that it will be possible to change strings in the phtml files that handle ‘Categories’. Unfortunately no success. Googled all topics available no straight-forward answers.

I followed all of your let’s build series which helped me to be Running a 2.2.6 magento (Ultimo theme) website and any idea on how to achieve the categories label text change would be greatly appreciated.

Kindest,
Teo

2 Likes

Thanks, @Teodor_Bogdanov1

Ok, so rather than just give you the answer, I figured readers may learn more if I explained my process of how I found the answer.

1. Finding the file

After installing the theme, I went into Developer Mode and enabled the following option in System > Configuration > Developer > Debug

  • Enabled Template Path Hints for Storefront = Yes
  • Then cleared the cache.

When viewing the Frontend, this gave me a hint of the filename that was responsible for the output:

app/code/Infortis/UltraMegamenu/view/frontend/templates/categories.phtml

debug_01

After finding the file, I disabled “Enabled Template Path Hints for Storefront” to make it easier to read the Google Chrome Inspect Element output. Otherwise it looks all messy whilst this feature is still enabled.

2. Finding the code

Then I used Google Chrome Inspect Element tool on the word “Categories” to help me get my bearings in the categories.phtml file.

I then opened the categories.phtml file to see if I could find this bit of code. Once I found my bearings (in this case block-title) it gave me all of the breadcrumbs I needed to find the anwer:

<div class="block-title">
    <strong><span><?php echo $title; ?></span></strong>
</div>

So, the “Categories” label on the Frontend is being created by a variable called “$title”. Having found this, I worked my way back up the page to find what “$title” was being created by and found this line:

//Sidebar block title
$title = $block->renderBlockTitle();

This told me that the label was being pulled from another variable called “$block”. So, I scrolled further back up the page and found this line:

$helper = $block->getHelperData();

So a “$helper” is normally used to “help” get variables and is seen a lot in Theme Files. Therefore, this gave me the idea that the value of “Categories” is stored as a setting in the Database. And if it’s in the Database then it must be a setting in the backend.

3. Answer

So having already determined that the settings were related to the Menu (based on the location of the categories.phtml file) and the variable was most likely a setting in the backend, I went to System > Configuration > Infortis Extensions > Menu and found this:

  • Block Title = Categories

So I changed it and cleared the cache:

debug_03

Final Words

Yes, I could have just given you the answer, but no-one will learn anything that way. I hope this helps :+1:

@digitalstartup I truly appreciate all the time you’re taking to respond and yet again very helpful indeed! People like you will always make a difference. Take care buddy

1 Like