Opencart extensions free download · 6 min read · Updated

File Manager Search for OpenCart 4: Find Images by Any Word in the Name, in Any Case and Subfolder (Free Extension)

The OpenCart 4 image manager only finds names that start with the exact search text. This free extension finds any word, in any case and order, in every subfolder.

Opencart 4 file manager search

Your image library has a photo called “Toy car red.png”. You open the image manager in OpenCart 4, type “toy car” or just “car” in the search box, and get an empty screen. Only “Toy car” with a capital T finds it, and only if you are already in the right folder. Once a store has a few thousand product photos, finding one becomes a scroll through page after page of thumbnails. That is how the OpenCart 4 file manager search works out of the box.

The free File Manager Search extension fixes the OpenCart 4 file manager search. It finds images whose name contains your words anywhere, in any letter case and in any order, in the open folder and every folder inside it. It was built for a store owner who hit exactly this problem, and tested on OpenCart 4.1.0.4.

Download: filesearch.ocmod.zip (tested on OpenCart 4.1.0.4).

OpenCart 4 Image Manager with the search car showing Red toy car.png, Toy car red.png, toy-car-blue.png and vintage/Toy car 1965.png
“car” finds all four toy cars, including one in a subfolder.

Why the core OpenCart 4 file manager search misses files

Here is the test folder: five images and a vintage subfolder with one more.

OpenCart 4 Image Manager showing the toys folder with a vintage subfolder and the images Doll house, Red toy car, TOY_TRUCK_white, Toy car red and toy-car-blue
The toys folder used in the tests.

Searching for “toy car” in this folder returns nothing:

Core OpenCart 4 Image Manager search for toy car in lower case with no results
Core search: “toy car” finds nothing.

The reason is one line in admin/controller/common/filemanager.php in OpenCart 4.1.0.4. Every name in the folder is skipped unless it starts with the search text:

if ($filter_name && !str_starts_with($value, $filter_name)) {
    continue;
}

str_starts_with() compares from the first character and is case-sensitive. So the core search:

  • finds “Toy car red.png” for “Toy car” and “Toy”, but not for “toy car”, “car” or “red”;
  • never finds “Red toy car.png” or “toy-car-blue.png” for “Toy car”;
  • only looks at the folder that is open, never inside subfolders.
Core OpenCart 4 Image Manager search for Toy car with a capital T showing only Toy car red.png
Core search: only the exact start “Toy car” finds one file.

What the extension changes

  • Anywhere in the name. “car”, “red” and “1965” all find “Toy car 1965.png”.
  • Any letter case. “TOY CAR”, “toy car” and “Toy Car” give the same results.
  • Words in any order. “red car” finds both “Red toy car.png” and “Toy car red.png”. You can switch this to exact phrase matching in the settings.
  • Separators don’t matter. Spaces, dashes, underscores and dots count as the same, so “toy car” finds toy-car-blue.png and “truck” finds TOY_TRUCK_white.png.
  • Subfolders. The search covers the open folder and every folder inside it. A result from a subfolder shows where it is, such as “vintage/Toy car 1965.png”, so two files with the same name can be told apart.
  • Best matches first. Folders come first, then names that start with your search, then names that contain it as a phrase, then the rest. Results from the open folder come before results from deeper folders.
OpenCart 4 Image Manager with the extension: search red car showing Red toy car.png and Toy car red.png
“red car” finds both names, whatever the word order.

Everything else works as before: click a result to put it in the product image field, tick results to delete them, and use the page numbers to move through results. The search term stays in the box across pages. When you clear the search box, you get the normal core folder view.

Install the extension

  1. Download filesearch.ocmod.zip. Don’t unzip it.
  2. Go to Extensions > Installer, click Upload and choose the zip.
  3. Click the green Install button next to “File Manager Search”.
  4. Go to Extensions > Extensions, choose Modules, find File Manager Search and click Install.
  5. Click Edit, switch Status on and click Save.

OpenCart uses the same image manager for product, category and manufacturer images, banners and images inserted in the description editor, so the new search works in all of them.

Settings

File Manager Search settings in OpenCart 4 admin with Status, Search subfolders and Match
Three settings.
SettingDefaultWhat it does
StatusOffTurns the new search on. When off, the image manager uses the core search.
Search subfoldersOnAlso searches every folder inside the open folder. Turn it off to search only the open folder, like core does.
MatchAll words“All words, in any order” or “The exact phrase anywhere in the name”. With the phrase setting, “car red” finds “Toy car red.png” but not “Red toy car.png”.

How it works

The extension doesn’t edit any core file. On install it adds one event on the image manager’s list action:

$this->model_setting_event->addEvent([
    'code'        => 'filesearch',
    'description' => 'File Manager Search: substring, case-insensitive image manager search',
    'trigger'     => 'admin/controller/common/filemanager.list/before',
    'action'      => 'extension/filesearch/module/filesearch.route',
    'status'      => 1,
    'sort_order'  => 0
]);

In OpenCart 4, a “before” event on a controller receives the route by reference and can change it. When there is a search term, the event points the request at the extension’s own list method. Without a search term, it does nothing, so normal browsing stays 100% core:

public function route(string &$route, array &$args): void {
    if (trim((string)($this->request->get['filter_name'] ?? '')) === '' || !$this->config->get('module_filesearch_status')) {
        return;
    }

    $route = $this->route . '.list';
}

The extension’s list method walks the folder, compares each name with the search after both have been through the same clean-up, and renders the results with the core common/filemanager_list view. That is why the image manager looks the same and the select, delete and upload buttons keep working. This is the clean-up:

private function normalize(string $text): string {
    return trim(preg_replace('/[\s\-_.]+/u', ' ', mb_strtolower($text, 'UTF-8')));
}

Two safety checks are added that the core list doesn’t make. The directory parameter is resolved with realpath() and must stay inside image/catalog/, and every result is checked the same way, so a symbolic link can’t pull in files from elsewhere on the server. In our test, a request with directory=../../system searched image/catalog/ instead. Thumbnails are only made for the 16 results on the current page.

What we tested

Search in the toys folderCore OpenCart 4.1.0.4With the extension
Toy carToy car redToy car red, toy-car-blue, vintage/Toy car 1965, Red toy car
toy carnothingthe same four
carnothingthe same four
CAR RED, red carnothingToy car red, Red toy car
trucknothingTOY_TRUCK_white
1965nothingvintage/Toy car 1965
zzznothingnothing

In the product form, clicking “vintage/Toy car 1965.png” in the results filled the image field with catalog/toys/vintage/Toy car 1965.png and closed the image manager. A search for “png” from the top folder gave three pages of results, and page 2 kept the search term. The browser console showed no errors.

Limitations

  • Matching is on file names only. OpenCart doesn’t store titles or tags for images, so a photo called IMG_4521.jpg can only be found by that name. Renaming files to describe the product helps search, and it helps image SEO too.
  • Words match inside longer words, so “car” also finds cart.png and opencart-logo.png.
  • A search from the top folder reads the whole image library on every search. It stops after 50,000 files and folders, which covers most stores. On a very large library, open the right folder first.
  • Results are sorted by match quality, not by date.
Rupak Nepali
Written byRupak Nepali

Rupak Nepali is a web developer, manage Webocreation website and the author of six books:
Getting Started with OpenCart Module Development (Packt, 2013),
OpenCart Theme and Module Development (Packt, 2015),
OpenCart 4: Dev Guide for Themes & Extensions (2024),
OpenCart 4: User Manual (2025),
Cloudflare for the Enterprise Website (2026) and
The Technical Web Guide for Marketers (2026).
Rupak has built OpenCart stores and extensions since 2010, has published more than 600 tutorials on Webocreation, and shares free OpenCart extensions on GitHub.
Find Rupak on
GitHub | Amazon | LinkedIn | X | YouTube.

Leave a Reply

Your email address will not be published. Required fields are marked *