Jump to content

Fatal error: Call to a member function assign() on null If I set the site in another language in prestashop


Recommended Posts

Prestahop 1.6.1.0 Basic Theme

If I set the site in another language, english spanish or french, the header menu and cart doesn't work, but once i reload that page error will be hide and display page perfectly.

I am getting following error:

Fatal error: Call to a member function assign() on null

My code is as below:

classes\module\Module.php

    public function display($file, $template, $cache_id = null, $compile_id = null)
    {
        if (($overloaded = Module::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === null)
            return Tools::displayError('No template found for module').' '.basename($file, '.php');
        else
        {
            if (Tools::getIsset('live_edit') || Tools::getIsset('live_configurator_token'))
                $cache_id = null;

            $this->smarty->assign(array(
                'module_dir' =>    __PS_BASE_URI__.'modules/'.basename($file, '.php').'/',
                'module_template_dir' => ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/',
                'allow_push' => $this->allow_push
            ));

            if ($cache_id !== null)
                Tools::enableCache();

            $result = $this->getCurrentSubTemplate($template, $cache_id, $compile_id)->fetch();

            if ($cache_id !== null)
                Tools::restoreCacheSettings();

            $this->resetCurrentSubTemplate($template, $cache_id, $compile_id);

            return $result;
        }
    }

Thank you in advance for your help!

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...