Jump to content

Accessing Hook Arg in Template


Recommended Posts

Hello! i'm trying  to access a hook param inside my template how can i do it?

For example in this case 

public function hookDisplayOrderConfirmation($params)
    {
        
        return $this->display(__FILE__, 'teste.tpl');
    }

the $params var contains some data ,that i would like to use in the template teste.tpl but i have no idea how to access it any indication would be appreciated, the data i'm trying to use is order_id

Link to comment
Share on other sites

  • 1 year later...

Hi again,

 

You have to assign your $params to smarty so that you can use them is your .tpl.

 

$this->context->smarty->assign(
    array(
          'variable1' => $params['variable1'],
          'variable2' => $params['variable2'],
          'variable3' => $params['variable3']
    )
);

 

Then use in you teste.tpl

<p> My first variable : {$variable1} </p>
<p> My second variable : {$variable2} </p>
<p> My third variable : {$variable3} </p>

 

Bruno-

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