NeedZoom Posted April 26, 2018 Share Posted April 26, 2018 Hi, I have create a module that display tpl ( hook) with static data. I want to add a input in this tpl and save the data in db when the client click a btn submit. I have sreach in internet but i dont find a module with form in tpl Link to comment Share on other sites More sharing options...
jgamio Posted April 26, 2018 Share Posted April 26, 2018 You can use ajax to fire your process when the button is press, Check the newsletters module for example Link to comment Share on other sites More sharing options...
NeedZoom Posted April 27, 2018 Author Share Posted April 27, 2018 (edited) ok I can work with the order detail ? my hook tpl is display iin the modal of the cart Edited April 27, 2018 by NeedZoom (see edit history) Link to comment Share on other sites More sharing options...
NeedZoom Posted April 27, 2018 Author Share Posted April 27, 2018 (edited) where i can write in my module.php the "if (Tools::isSubmit('submitMyBtn')) {.....}" when the client clicked the btn in fond.tpl ? like in module newsletters : if (Tools::isSubmit('submitNewsletter')) {$this->newsletterRegistration(); Edited April 27, 2018 by NeedZoom (see edit history) Link to comment Share on other sites More sharing options...
NeedZoom Posted April 27, 2018 Author Share Posted April 27, 2018 i fond this exp : https://www.prestashop.com/forums/topic/278900-how-to-use-ajax-call-in-a-moduleto-check-whether-the-mobile-phone-number-already-exists/ but he work with get ! how can i work with post? Link to comment Share on other sites More sharing options...
jgamio Posted May 1, 2018 Share Posted May 1, 2018 Change type from get to post or you mean how pass the value ? Link to comment Share on other sites More sharing options...
NeedZoom Posted May 2, 2018 Author Share Posted May 2, 2018 (edited) thanks, how can know the id of the cart? for the id of the customer: in my module : global $smarty; $id_customer = null; if ($this->context->customer->isLogged()) { // code to execute if i am logued $id_customer = $this->context->customer->id; } for the product : in the theme : {hook h='displayMaperso' product=$product} in my module : if (!isset($params['product'])) { return; } $product = $params['product']; $id_prod =(int) $product['id_product']; $this->context->smarty->assign(array('id_prod' => $id_prod)); return $this->display(__FILE__, 'maperso.tpl'); Edited May 2, 2018 by NeedZoom (see edit history) 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