Jump to content

Execute Javascript When firing actionHook


ZiedDams

Recommended Posts

Hi, Hope everything is fine.

Im developing a module on prestashop 1.7 and i got my self in trouble so my be someone can help me.

Im registring the Hook

actionCustomerAccountAdd
$this->registerHook('actionCustomerAccountAdd')

in my Javascript part of the module im using

localStorage
localStorage.setItem('item_name','item_value');

and i want in my hook function

public function hookActionCustomerAccountAdd($params)

To delete that item from localStorage

 

Thank you in advance and have a nice day .

  • Like 1
Link to comment
Share on other sites

4 hours ago, 4you.software said:

Hi

public function hookActionObjectCustomerAddAfter($params)
{
	$this->context->controller->addJs('modules/'.$this->name.'/js/your.js');
	$id_customer = (int)$params['object']->id;
	$jsDef = [
		'id_customer' => $id_customer,
	];
	Media::addJsDef($jsDef);
}

 

Thank you, i will use this solution

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