Nicole themes

Making themes, writing code.

Opencart 3.0 theme compatibility with Opencart 2.3.x switch twig to php (tpl) back

The latest opencart version (3.0) has changed the template engine from php (tpl files) to twig (twig files). To keep using your opencart 2.x themes you need to apply the below patch.

Patching system/library/template/twig.php

You will need to add tpl file checking in render method to first load tpl files before failing back to twig, this is how render module should be

    public function render($template) {

        //tpl compatibility
        $file = DIR_TEMPLATE . $template . '.tpl';

        if (is_file($file)) {



            return ob_get_clean();

        try {
            // load template
            $template = $this->twig->loadTemplate($template . '.twig');

            return $template->render($this->data);
        } catch (Exception $e) {
            trigger_error('Error: Could not load template ' . $template . '!');

Further things to convert

You might also need to change opencart modules code (if your theme is shipped with custom modules) because some models have been renamed again.

Most things like modules path and some models have been renamed already for 3 times since Opencart 2.0.

For example extension/extension model has changed to setting/extension, you can use a diff tool to compare opencart code to opencart 3.0 and see the models and extensions rename.