ZiedDams Posted December 14, 2022 Share Posted December 14, 2022 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 . 1 Link to comment Share on other sites More sharing options...
ps8modules Posted December 16, 2022 Share Posted December 16, 2022 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); } 1 1 Link to comment Share on other sites More sharing options...
ZiedDams Posted December 16, 2022 Author Share Posted December 16, 2022 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 1 Link to comment Share on other sites More sharing options...
ps8modules Posted December 16, 2022 Share Posted December 16, 2022 I gladly helped 😉 1 1 Link to comment Share on other sites More sharing options...
ps8modules Posted December 16, 2022 Share Posted December 16, 2022 You can easily call back a function in the module via ajax. I'm happy to provide a sample if needed 🙃 Link to comment Share on other sites More sharing options...
ZiedDams Posted December 16, 2022 Author Share Posted December 16, 2022 1 hour ago, 4you.software said: You can easily call back a function in the module via ajax. I'm happy to provide a sample if needed 🙃 yes i got it, thanks 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now