Jump to content

PHP Fatal error: Uncaught --> Smarty: 0():Missing '$template' parameter


Recommended Posts

Hello,

Wondering if anyone can help me in the right direction..

I have upgraded from 1.6.X.X to 1.7.5.0, everything seemed to be ok, now all of a sudden I have this error! when I say all of a sudden, I mean that the upgrade was made a month ago and the error is about 2 days old

PHP Fatal error:  Uncaught  --> Smarty: 0():Missing '$template' parameter <--  thrown in /home/********/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php on line 177

***** - is my host name blured out.

What appears to be the problem? Does anyone know?

Many thanks,

Daniel

P.S: at first sight the frontend of the store seems to be ok but I would like to know what is this error and if it affects my shop in any way and the activity on it

Edited by dannielhendrix (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
  • 9 months later...
  • 2 weeks later...
  • 1 month later...
  • 3 weeks later...

i have same problem someone can help me please  AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught  --> Smarty: 0():Missing '$template' parameter <-- \n  thrown in /var/www/vhosts/.../.../vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php on line 177\n', referer: https://.../

Link to comment
Share on other sites

  • 4 weeks later...

I'm also getting same error can any one help me on this? Whether this causes the order creation after successful payment?

[27-Aug-2020 08:26:37 Asia/Kolkata] PHP Fatal error:  Uncaught  --> Smarty: 0():Missing '$template' parameter <-- 
  thrown in /home/public_html/e/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php on line 177
[27-Aug-2020 08:32:41 Asia/Kolkata] PHP Fatal error:  Uncaught  --> Smarty: 0():Missing '$template' parameter <-- 
  thrown in /home/public_html/e/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php on line 177
[27-Aug-2020 09:33:43 Asia/Kolkata] PHP Fatal error:  Uncaught  --> Smarty: 0():Missing '$template' parameter <-- 
  thrown in /home/public_html/e/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php on line 177

 

Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...
  • 11 months later...
15 minutes ago, Webo.Agency said:

Change this:
 

$html = $this->display($location);

to this:

$this->setTemplate( $location );
$html = $this->display($location);

 

I am assuming these changes are made in the smarty_internal_templatebase.php?

My line 177 in this php file reads as follows:

 

Quote

{

        $smarty = $this->_getSmartyObj();

        $saveVars = true;

        if ($template === null) {

            if (!$this->_isTplObj()) {

                throw new SmartyException($function . '():Missing \'$template\' parameter');

            } else {

                $template = $this;

            }

I am utilising PS 1.7.8.7 with PHP 7.4.30 - I am assuming there have been changes made previously to fix this with a release, but it now seems to have reared its head again. Any advice will be most certainly welcome as this error is slowing down our sites as well as effecting our sales in the process.

TIA

Link to comment
Share on other sites

On 9/19/2022 at 3:41 PM, webbrent said:

I am assuming these changes are made in the smarty_internal_templatebase.php?

My line 177 in this php file reads as follows:

 

I am utilising PS 1.7.8.7 with PHP 7.4.30 - I am assuming there have been changes made previously to fix this with a release, but it now seems to have reared its head again. Any advice will be most certainly welcome as this error is slowing down our sites as well as effecting our sales in the process.

TIA

No, assume modules that use implementation of "$this->display" in modules

Find in project all places where "$this->display" is used and add above "$this->setTemplate( $location );" where $locations is only example there (use existing parameter)

It is working fine in native modules and core. 

If liked to be fixed then pleas add pull request with solution from your perspective as a IT guy. Pleas upgrade all modules and check compatibility

There is many breaking change between 1.6.X.X and 1.7.X.X

You can contact us for support if needed :)

Edited by Webo.Agency
Add information about versions (see edit history)
Link to comment
Share on other sites

I have isolated the module causing the error... Data mining for statistics seems to be throwing the aforementioned error. When disabled it stops throwing the Apache Error with regards to "Missing $Template Parameter.

However now it has started throwing the following error when navigating the "Dashboard" section of the BO.

 

Quote

[Fri Sep 23 16:02:25.739578 2022] [php7:warn] [pid 238646] [client xxx.xxx.xxx.xxx:57574] PHP Warning:  Invalid argument supplied for foreach() in /var/www/domain.co.za/html/modules/dashproducts/dashproducts.php on line 219, referer: https://domain.co.za/adminxxxxxxxxx/index.php?controller=AdminDashboard&token=xxxxxxxxxxxxxxxxxxxxx


I have attempted to reset the module and it has done nothing favourable either. Perhaps a total removal of this module would be more ideal.
 

Edited by webbrent (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
On 9/23/2022 at 4:04 PM, webbrent said:

I have isolated the module causing the error... Data mining for statistics seems to be throwing the aforementioned error. When disabled it stops throwing the Apache Error with regards to "Missing $Template Parameter.

However now it has started throwing the following error when navigating the "Dashboard" section of the BO.

 


I have attempted to reset the module and it has done nothing favourable either. Perhaps a total removal of this module would be more ideal.
 

Removing it for favor of Matamoto or Google Analytics or other tool is great approach. It isn't updated as module and viable right now as functional.

Link to comment
Share on other sites

  • 3 months later...

My solution.

modify /classes/controller/FrontController.php:724 

$html .= $this->context->smarty->fetch($tpl, null, $theme . $this->getLayout());

to

$html .= $this->context->smarty->fetch($tpl, null, $theme .'/templates/'. $this->getLayout());

and  /classes/controller/FrontController.php:727

$html = $this->context->smarty->fetch($content, null, $theme . $this->getLayout());

to 

$html = $this->context->smarty->fetch($content, null, $theme .'/templates/'. $this->getLayout());

 

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

Just in case this may help anyone. I've found myself in this situation too.

In my case, the error was triggered because the template was not set in the initContent method from a module's FrontController.

 

In case you're using your own FrontControllers there are two possible solutions

  1. Set the template to use by adding the
    $this->setTemplate('...');
    to the initContent call
  2. Make the script end before reaching the end of the method (for example if it was an ajax call, where you just need to output some content). To end it you can use the keyword
    exit;

     

  • Thanks 1
Link to comment
Share on other sites

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...