Jump to content

How to execute module's function in the hook without .tpl?


tridcatij

Recommended Posts

Hello everybody!

 

Maybe question is not correct, I will try to explain.

 

When customer making an order, on the "Choose payment method" step I need to get value from the previous "Carrier" page and put it into the $cookie->var.

 

So the question is - is it necessary to call .tpl file? Because I don't need to show any info in the hook, I only need to execute this small script.

 

I tried to make it with .tpl also, but there was no result:

 

 

public function hookpayment($params)
{
global $cookie;
$cookie->indoorChecked = (int)Tools::getValue('id_indoor');
$cookie->write();
$smarty->assign('indoorChecked', $cookie->indoorChecked);
return $this->display(__FILE__, _PS_THEME_DIR_.'payment.tpl');
}

 

Hoping for your assistance.

Link to comment
Share on other sites

No, your hook function doesn't need to display anything. As long as you make an appropriate call to $this->registerHook() in the install function. What version of Prestashop are you using though? (Your code isn't correct for 1.5.4 plus you're accessing the variable $smarty when it hasn't been declared/initialised).

Link to comment
Share on other sites

Paul C,

Thanks for your reply! I'm using 1.4.9.0 version. ($smarty declared also, I forgot to write it in this example.)..so the correct code should look like this:

 

public function hookpayment($params)
{
global $cookie;
$cookie->indoorChecked = (int)Tools::getValue('id_indoor');
$cookie->write();
}

?

Link to comment
Share on other sites

  • 3 months 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...