feho1 Posted February 11, 2021 Share Posted February 11, 2021 (edited) Hi, everyone. I have module that is using admin controller to do some stuff, in there i call database and search for all products and it is working fine. What i want is to get the current id_product from hookDisplayAdminProductsExtra but I cant call that in controller. Even thou i use Hook::exec The function does not even get executed since i am not calling it form module but from hook. So what i want is to get id_product from hooks $params and pass it to controller and use it as argument when doing db search prestashop 1.7.6.7 php 7.2 Solved by using ajax passing the data from smarty tpl to controller Edited February 16, 2021 by feho1 (see edit history) Link to comment Share on other sites More sharing options...
elburgl69 Posted February 11, 2021 Share Posted February 11, 2021 Working on assumption here. In you module you redirect to your controller like this? Tools::redirectAdmin($this->context->link->getAdminLink('AdminYourController')); getAdminLink full declaration is: Link::getAdminLink($controller, $withToken = true, $sfRouteParams = array(), $params = array()) If you call it with $params['id_product'] = $id_product; You can access that value in your controller with $id_product = Tools::getValue("id_product"); Don't forget to check if the id_product value is set to begin with (Tools::getIsset('id_product')). rg, Leo 1 Link to comment Share on other sites More sharing options...
feho1 Posted February 16, 2021 Author Share Posted February 16, 2021 Thank you for your reply and sorry for late reply. I ended up using ajax and passed it to controller from tpl. Appreciate the time you took to reply. 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