In OpenCart, admin and catalog are two separate MVC applications. Each has its own entry point, config, controllers, models, language files, and templates. The only things they share are the system/ core and the database. If you keep the model "opencart admin catalog = two applications, one core" in mind, it becomes clear why a module consists of two halves, why the admin product model is unsuitable for the storefrontWhat the customer sees: the home page, categories, product page, and cart. More in the glossary →, and why an event without the correct prefix simply doesn't fire.
Examples are for OpenCart 4.1; in 4.0.x, model triggers and event handling differ.
Why is OpenCart split into admin and catalog?
The admin panel and the storefront solve different tasks, so they have different requirements. The storefront serves anonymous visitors and customers. It needs SEO URLs, the cart, currency, taxes, the customer session, and fast catalog reads. The admin panel needs manager authentication, an access-rights check on every route, a CSRF token in the URL, and full CRUD operations on data. If everything lived in one application, every storefront request would carry the admin's extra checks, and every admin request would carry the cart logic.
That is why OpenCart puts them in separate directories, and each request is handled from start to finish by only one of the applications:
- catalog: the storefront. The site root,
index.phpandconfig.phpin the root, code incatalog/; - admin: the control panel.
admin/index.phpandadmin/config.php, code inadmin/; - system: the shared core. The engine (ControllerCode that receives a request and prepares data. More in the glossary →, Model, Loader, Registry, Event), libraries (DB, Request, Response, Session, Cache, Url, Template), helpers, and base configs.
A detailed directory map for both versions is described in the article about the OpenCart file structure. Here we'll look at what this separation means for a developer.
In practice, there is no "magic" in cross-application code calls. An admin controller cannot directly call a storefront controller via $this, and vice versa. The Loader always looks for files relative to the current application, that is, relative to DIR_APPLICATION.
How does one framework run two different applications?
Both entry points work the same way: they include their own config.php with path constants, then system/startup.php, and then hand control to the shared framework, telling it the application name: catalog or admin. The framework loads the base system/, and on top of it the config of the specific application: system/ or system/. It is this second file that turns the same core into either the storefront or the admin panel. The request path is broken down step by step in the article framework.php: from index.php to the controller.
flowchart TD
A["/index.php"] --> C["config.php storefront"]
B["/admin/index.php"] --> D["admin/config.php"]
C --> E["system/startup.php"]
D --> E
E --> F["system/framework.php"]
F --> G["system/config/default.php"]
G --> H{"Which application?"}
H -->|"catalog"| I["system/config/catalog.php"]
H -->|"admin"| J["system/config/admin.php"]
I --> K["storefront startup actions: session, settings, SEO URL"]
J --> L["admin startup actions: login, permissions, token"]
K --> M["Controller catalog/controller/..."]
L --> N["Controller admin/controller/..."]
The application config defines several key things. The first is the default route: for the storefront it is the home page (common/home), for the admin panel it is the dashboard (common/dashboard). The second is the list of pre-actions, that is, startup controllers that run before the main one. The third is the autoloading of libraries and language files. The fourth is whether the session starts automatically.
The constants in config.php are also different. In the storefront, DIR_APPLICATION points to catalog/, while in the admin panel it points to admin/. The admin config has additional constants HTTP_CATALOG and DIR_CATALOG so that the admin panel can build links to the storefront and know where its files are located. How file configs are combined with settings from the setting table is covered in the article about config.php and system/config.
How do admin and catalog differ in practice?
The differences are easiest to see in a table. They are the same in essence in both versions, although the specific names of startup controllers changed in 4.1.
| Aspect | catalog (storefront) | admin (admin panel) |
|---|---|---|
| Entry point | /index.php | /admin/index.php |
| File config | /config.php | /admin/config.php |
| Application config | system/ | system/ |
| Default route | home page | dashboard (or login if not authenticated) |
| User objects in Registry | customer, cart, currency, tax | user |
| Route protection | customer login check in individual controllers | startup checks for login, user_token, and group permissions |
| Templates | 3.0: catalog/; 4.1: catalog/ plus theme extensions | admin/ |
| Language files | catalog/ | admin/ |
| SEO URL | yes, via a startup controller | no, only ?route= |
Objects such as $this->customer or $this->user appear in the Registry only in their "own" application. The classes are shared in system/, but they are registered by the startup controllers of the specific application. This leads to a common mistake: accessing $this from an admin controller results in a fatal error or an empty result, because that object simply doesn't exist in the admin panel.
Another difference is the token. In the admin panel, every link contains user_token from the session, and the login startup controller rejects a request without the correct token. The storefront has no such mechanism.
Why are admin and catalog models with the same name different classes?
The trickiest thing for a newcomer is identical routes. Both the admin panel and the storefront have a catalog/product model, but these are two different files with different logic.
admin/is CRUD:model/ catalog/ product.php addProduct(),editProduct(),deleteProduct(), and fetching raw data for the edit form without considering status, availability date, or customer groupA segment of buyers (retail, wholesale) with different prices and terms. More in the glossary →.catalog/is read-only for the customer: it takes into account product status, store assignment, customer group, promotions and discounts, and returns the rating and the ready price with the special price.model/ catalog/ product.php
Calling $this in the admin panel will always load the admin model, and in the storefront the storefront model. The Loader cannot load a model from the "other" application. So if you need a function in the storefront that exists only in the admin model, the correct approach is to write your own model in the catalog part of your module, rather than including the admin file via require. Otherwise you'll get a class name conflict: in OpenCart 3.0 both models are called ModelCatalogProduct, and in 4.1 they differ only by namespace.
The shared layer between the applications is the database and the settings table. A module stores its parameters in the admin panel via model_setting_setting, and the storefront reads them via $this, because store settings are loaded into the config at the start of the request. The admin panel takes store settings from store_id 0, while the storefront determines the store by URL.
How is a module split into two halves in 3.0 and 4.1?
Almost every extension has two parts: the admin part (settings form, installation, uninstallation, permissions) and the storefront part (what the customer sees). The difference between versions lies in where these parts are located.
OpenCart 3.0
Module files are embedded into the core tree:
admin/controller/extension/module/hello.php
admin/language/en-gb/extension/module/hello.php
admin/view/template/extension/module/hello.twig
catalog/controller/extension/module/hello.php
catalog/language/en-gb/extension/module/hello.php
catalog/view/theme/default/template/extension/module/hello.twig
The route is the same in both applications, extension/, but different code runs depending on which index.php the request came through.
OpenCart 4.1
The extension lives in its own extension/ directory, and inside it there are again two applications:
extension/myvendor/admin/controller/module/hello.php
extension/myvendor/admin/language/en-gb/module/hello.php
extension/myvendor/admin/view/template/module/hello.twig
extension/myvendor/catalog/controller/module/hello.php
extension/myvendor/catalog/language/en-gb/module/hello.php
extension/myvendor/catalog/view/template/module/hello.twig
The route has the form extension/, and the class namespace explicitly names the application:
Example
namespace Opencart\Catalog\Controller\Extension\Myvendor\Module;
class Hello extends \Opencart\System\Engine\Controller {
public function index(array $setting = []): string {
$this->load->language('extension/myvendor/module/hello');
$data['title'] = $setting['name'] ?? $this->language->get('heading_title');
$data['enabled'] = (bool)$this->config->get('module_hello_status');
return $this->load->view('extension/myvendor/module/hello', $data);
}
}
The admin controller of the same module has the namespace Opencart\Admin\Controller\Extension\Myvendor\Module. In OpenCart 4.1 the method in the route is separated by a dot (.save); the old separator | is automatically replaced with a dot. In 3.0 a slash is used (extension/).
The manager sees the admin part of the module in the "ExtensionsAdditional functionality: a module, a payment or shipping method, a feed, or a theme. They are managed in "Extensions → Extensions." More in the glossary → → Extensions" section, by selecting the extension type "Modules": here the module is installed and its settings form is opened. When installed, OpenCart automatically grants the current user's group permissions for the module's route.

How are events and access rights tied to a specific application?
The event system is shared, the event table is one for both applications, but each trigger starts with the application name: catalog/… or admin/…. The event startup controller in each application registers only those records whose trigger has its prefix, and the prefix itself is stripped off. That is, an event with the trigger catalog/ (3.0) or catalog/ (4.1) will fire only in the storefront, and admin/ only in the admin panel. The action (action) specifies a route relative to the same application, so for an event with the catalog/ prefix the handler must be located in the catalog part of the module.
The event is usually registered in the admin method install():
Example
// OpenCart 4.1, адмінський контролер модуля
$this->load->model('setting/event');
$this->model_setting_event->addEvent([
'code' => 'hello_order_notify',
'description' => 'Сповіщення після зміни статусу замовлення',
'trigger' => 'catalog/model/checkout/order.addHistory/after',
'action' => 'extension/myvendor/module/hello.notify',
'status' => 1,
'sort_order' => 0
]);
In OpenCart 3.0 the same model method accepts separate arguments: code, trigger, action, status, and sort order. Registered events are visible in the "Extensions → Events" section, where they can also be temporarily disabled during debugging.

Access rights exist only in the admin panel. For each user group, lists of routes are defined with "access" and "modify" permissions, and the startup controller checks the current route before execution. They are edited in "System → Users → User Groups". If after manually copying module files you get "Permission denied", you should usually check this exact list.

Where do admin and catalog intersect, and what are the pitfalls?
Despite the separation, the applications have several points of contact, and this is where modules most often break.
- Database and settings. Fully shared. The admin panel writes, the storefront reads. Module settings keys must match in both parts down to the character, including the prefix
module_,payment_, and so on. - Session. Both applications use the same session mechanism and drivers from
system/, but they store different data in it: the admin panel storesuser_idanduser_token, the storefront stores customer and cart data. Details are in the article about OpenCart sessions and cache. - Cache and storage. The cache directory is shared. Clearing the cache in the admin panel affects the storefront, and this is often needed after changing settings that the storefront caches. The contents of the directory are covered in the article about the storage directory.
- Links between applications. The admin panel builds storefront URLs via the
HTTP_CATALOGconstant (or the store URL from settings), not via$this, because the latter generates links to the current application.->url ->link() - Images. Both applications work with the same
image/directory, but resizing for the storefront is done by the storefronttool/imagemodel, while the admin panel has its own model with the same name. - Order editing. The admin panel does not recalculate the cart itself but calls the API in the storefront, because all cart, shipping, and totals logic lives in the catalog. Therefore a shipping or totals module that works in the storefront must also work correctly in this scenario.
A separate note on OCMOD: modifications are applied to files by their full path, so a single XML can modify both admin/ and catalog/ at the same time. This is convenient, but during a core update you'll need to check both halves.
Summary
- Admin and catalog are two independent MVC applications with their own
index.php,config.php, config insystem/config/, startup actions, controllers, models, languages, and templates. - Only the
system/core, the database, settings, cache, and the images directory are shared. - Identical routes in the two applications are different classes with different logic. The Loader does not load code from the "other" application.
- A module almost always consists of two parts: in OpenCart 3.0 they are spread across
admin/andcatalog/, and in OpenCart 4.1 they are gathered inextension/and<vendor>/ admin extension/.<vendor>/ catalog - The event trigger determines the application by its prefix, and access rights exist only in the admin panel.
Next, it's worth walking through the path of a single request in detail and seeing how Request and Response handle input data and output. The remaining materials of this section are collected on the page Architecture and files of OpenCart.