Jump to content

Edit History

junkypic

junkypic

I'm using Prestashop 1.7.6.4 to develop a payment module. I want to render a template in a hook. I'm doing that via the following code:

class MyModuleName extends PaymentModule
{

    public function hookActionValidateOrder($params)
    {
        /**
         * Verify if this module is enabled
         */
        if (!$this->active) {
            return;
        }

        if (Configuration::get('inline')) {
            $this->context->smarty->assign([
                'module' => $order->module
            ]);

            return $this->display(__FILE__,
                'views/templates/hook/displayStatusOrder.tpl');

        }
        // more code goes here
    }

}

Do note that I've also tried with 

return $this->fetch('module:myModule/views/templates/hook/displayStatusOrder.tpl');

results are the same.

However I'm getting the following error:

(1/1) SmartyException
0():Missing '$template' parameter

in smarty_internal_templatebase.php line 177
at Smarty_Internal_TemplateBase->_execute(null, null, 'layouts/layout-full-width.tpl', null, 0)
in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch(null, null, 'layouts/layout-full-width.tpl', null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch(null, null, 'layouts/layout-full-width.tpl')
in FrontController.php line 683
at FrontControllerCore->smartyOutputContent(null)
in FrontController.php line 667
at FrontControllerCore->display()
in Controller.php line 312
at ControllerCore->run()
in Dispatcher.php line 515
at DispatcherCore->dispatch()
in index.php line 74

I'm absolutely sure that my template exists. And it has the correct name.

The template contains the following code:

{if $module == "myModule"}
    <script>
        $(document).ready(function() {
           alert('test');
        });

        alert('test');
    </script>
{/if}

My folder structure is like so:

    myModuleName
      views
        templates
          hook
            displayStatusOrder.tpl

I think it's because I'm trying to render it in this specific hook. It seems that for other hooks rendering templates works just fine.

I've tried deleting the cache, reinstalling the module, etc etc.

I'm clearly missing something obvious. Any help is appreciated.

junkypic

junkypic

I'm using Prestashop 1.7.6.4 to develop a payment module. I want to render a template in a hook. I'm doing that via the following code:

class MyModuleName extends PaymentModule
{

    public function hookActionValidateOrder($params)
    {
        /**
         * Verify if this module is enabled
         */
        if (!$this->active) {
            return;
        }

        if (Configuration::get('inline')) {
            $this->context->smarty->assign([
                'module' => $order->module
            ]);

            return $this->display(__FILE__,
                'views/templates/hook/displayStatusOrder.tpl');

        }
        // more code goes here
    }

}

Do note that I've also tried with 

return $this->fetch('module:myModule/views/templates/hook/displayStatusOrder.tpl');

results are the same.

However I'm getting the following error:

(1/1) SmartyException
0():Missing '$template' parameter

in smarty_internal_templatebase.php line 177
at Smarty_Internal_TemplateBase->_execute(null, null, 'layouts/layout-full-width.tpl', null, 0)
in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch(null, null, 'layouts/layout-full-width.tpl', null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch(null, null, 'layouts/layout-full-width.tpl')
in FrontController.php line 683
at FrontControllerCore->smartyOutputContent(null)
in FrontController.php line 667
at FrontControllerCore->display()
in Controller.php line 312
at ControllerCore->run()
in Dispatcher.php line 515
at DispatcherCore->dispatch()
in index.php line 74

I'm absolutely sure that my template exists. And it has the correct name.

The template contains the following code:

{if $module == "twocheckout"}
    <script>
        $(document).ready(function() {
           alert('test');
        });

        alert('test');
    </script>
{/if}

My folder structure is like so:

    myModuleName
      views
        templates
          hook
            displayStatusOrder.tpl

I think it's because I'm trying to render it in this specific hook. It seems that for other hooks rendering templates works just fine.

I've tried deleting the cache, reinstalling the module, etc etc.

I'm clearly missing something obvious. Any help is appreciated.

junkypic

junkypic

I'm using Prestashop 1.7.6.4 to develop a payment module. I want to render a template in a hook. I'm doing that via the following code:

class MyModuleName extends PaymentModule
{

    public function hookActionValidateOrder($params)
    {
        /**
         * Verify if this module is enabled
         */
        if (!$this->active) {
            return;
        }

        if (Configuration::get('inline')) {
            $this->context->smarty->assign([
                'module' => $order->module
            ]);

            return $this->display(__FILE__,
                'views/templates/hook/displayStatusOrder.tpl');

        }
        // more code goes here
    }

}

Do note that I've also tried with 

return $this->fetch('module:twocheckout/views/templates/hook/displayStatusOrder.tpl');

results are the same.

However I'm getting the following error:

(1/1) SmartyException
0():Missing '$template' parameter

in smarty_internal_templatebase.php line 177
at Smarty_Internal_TemplateBase->_execute(null, null, 'layouts/layout-full-width.tpl', null, 0)
in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch(null, null, 'layouts/layout-full-width.tpl', null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch(null, null, 'layouts/layout-full-width.tpl')
in FrontController.php line 683
at FrontControllerCore->smartyOutputContent(null)
in FrontController.php line 667
at FrontControllerCore->display()
in Controller.php line 312
at ControllerCore->run()
in Dispatcher.php line 515
at DispatcherCore->dispatch()
in index.php line 74

I'm absolutely sure that my template exists. And it has the correct name.

The template contains the following code:

{if $module == "twocheckout"}
    <script>
        $(document).ready(function() {
           alert('test');
        });

        alert('test');
    </script>
{/if}

My folder structure is like so:

    myModuleName
      views
        templates
          hook
            displayStatusOrder.tpl

I think it's because I'm trying to render it in this specific hook. It seems that for other hooks rendering templates works just fine.

I've tried deleting the cache, reinstalling the module, etc etc.

I'm clearly missing something obvious. Any help is appreciated.

junkypic

junkypic

I'm using Prestashop 1.7.6.4. I want to render a template in a hook. I'm doing that via the following code:

class MyModuleName extends PaymentModule
{

    public function hookActionValidateOrder($params)
    {
        /**
         * Verify if this module is enabled
         */
        if (!$this->active) {
            return;
        }

        if (Configuration::get('inline')) {
            $this->context->smarty->assign([
                'module' => $order->module
            ]);

            return $this->display(__FILE__,
                'views/templates/hook/displayStatusOrder.tpl');

        }
        // more code goes here
    }

}

Do note that I've also tried with 

return $this->fetch('module:twocheckout/views/templates/hook/displayStatusOrder.tpl');

results are the same.

However I'm getting the following error:

(1/1) SmartyException
0():Missing '$template' parameter

in smarty_internal_templatebase.php line 177
at Smarty_Internal_TemplateBase->_execute(null, null, 'layouts/layout-full-width.tpl', null, 0)
in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch(null, null, 'layouts/layout-full-width.tpl', null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch(null, null, 'layouts/layout-full-width.tpl')
in FrontController.php line 683
at FrontControllerCore->smartyOutputContent(null)
in FrontController.php line 667
at FrontControllerCore->display()
in Controller.php line 312
at ControllerCore->run()
in Dispatcher.php line 515
at DispatcherCore->dispatch()
in index.php line 74

I'm absolutely sure that my template exists. And it has the correct name.

The template contains the following code:

{if $module == "twocheckout"}
    <script>
        $(document).ready(function() {
           alert('test');
        });

        alert('test');
    </script>
{/if}

My folder structure is like so:

    myModuleName
      views
        templates
          hook
            displayStatusOrder.tpl

I think it's because I'm trying to render it in this specific hook. It seems that for other hooks rendering templates works just fine.

I've tried deleting the cache, reinstalling the module, etc etc.

I'm clearly missing something obvious. Any help is appreciated.

junkypic

junkypic

I'm using Prestashop 1.7.6.4. I want to render a template in a hook. I'm doing that via the following code:

class MyModuleName extends PaymentModule
{

    public function hookActionValidateOrder($params)
    {
        /**
         * Verify if this module is enabled
         */
        if (!$this->active) {
            return;
        }

        if (Configuration::get('inline')) {
            $this->context->smarty->assign([
                'module' => $order->module
            ]);

            return $this->display(__FILE__,
                'views/templates/hook/displayStatusOrder.tpl');

        }
        // more code goes here
    }

}

Do note that I've also tried with 

return $this->fetch('module:twocheckout/views/templates/hook/displayStatusOrder.tpl');

results are the same.

However I'm getting the following error:

(1/1) SmartyException
0():Missing '$template' parameter

in smarty_internal_templatebase.php line 177
at Smarty_Internal_TemplateBase->_execute(null, null, 'layouts/layout-full-width.tpl', null, 0)
in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch(null, null, 'layouts/layout-full-width.tpl', null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch(null, null, 'layouts/layout-full-width.tpl')
in FrontController.php line 683
at FrontControllerCore->smartyOutputContent(null)
in FrontController.php line 667
at FrontControllerCore->display()
in Controller.php line 312
at ControllerCore->run()
in Dispatcher.php line 515
at DispatcherCore->dispatch()
in index.php line 74

I'm absolutely sure that my template exists. And it has the correct name.

My folder structure is like so:

    myModuleName
      views
        templates
          hook
            displayStatusOrder.tpl

I think it's because I'm trying to render it in this specific hook. It seems that for other hooks rendering templates works just fine.

I've tried deleting the cache, reinstalling the module, etc etc.

I'm clearly missing something obvious. Any help is appreciated.

×
×
  • Create New...