OCMOD not working?

Sometimes OpenCart’s OCMOD system may stop working on the front-end and you may spend some quality time looking for the reason. It seems like cases like this are quite common, so here are a few guides on how to fix OCMOD related issue yourself.

What is causing the issue?

100% of the cases we’ve had, the issue has been caused by the presence of the DIR_CATALOG constant in the catalog’s config.php file. Since by default this constant is only present in the admin panel, the modification function checks if it is defined and if yes, it looks for modifications in the admin directory. So when the constant is present in the catalog part, OpenCart is confused and looks for modifications in the admin, but such are usually not present there or the modified files have completely different logic and errors start appearing.

How to fix this?

It will be best if you know which extension/customization is using the DIR_CATALOG constant in the catalog and contact its developer to ask them to fix the extension and remove the constant from the config.php file. That way you will keep a cleaner version of OpenCart, which helps in the future when you need to update the system.

Your second option is to modify the system/startup.php file. Open it and look for the modification function. It should be near the middle of the file and looks like this:

function modification($filename) {
    if (!defined('DIR_CATALOG')) {
        $file = DIR_MODIFICATION . 'catalog/' . substr($filename, strlen(DIR_APPLICATION));
    } else {
        $file = DIR_MODIFICATION . 'admin/' .  substr($filename, strlen(DIR_APPLICATION));

    if (substr($filename, 0, strlen(DIR_SYSTEM)) == DIR_SYSTEM) {
        $file = DIR_MODIFICATION . 'system/' . substr($filename, strlen(DIR_SYSTEM));
    if (is_file($file)) {
        return $file;

    return $filename;

change the following line

if (!defined('DIR_CATALOG')) {


if (basename(DIR_APPLICATION) == ‘catalog’) {

and this should fix the issue.

If you have any further questions, feel free to post them in the comment section below.


Join 11,000+ subscribers receiving actionable E-commerce advice

* Unsubscribe any time

Trending blogs

comments powered by Disqus