Tu Chu Posted February 12, 2019 Share Posted February 12, 2019 (edited) Hi all, I found some documents about actionAjaxDieBefore hook. In DevDocs, I saw it deprecated since 1.6.1.1 (https://devdocs.prestashop.com/1.7/modules/concepts/hooks/list-of-hooks/). However, in another document, I find it still visible in 1.7 (http://build.prestashop.com/news/new-updated-hooks-1-7-1-0/). Even, in 1.7's code, I saw it in file classes/controller/Controller.php I can't handle actionAjaxDieBefore hook. However, I can handle ActionAjaxDieCartControllerDisplayAjaxRefreshBefore (actionAjaxDie<ControllerName><Method>Before). I don't know why actionAjaxDieBefore not work? Edited February 13, 2019 by Tu Chu (see edit history) Link to comment Share on other sites More sharing options...
tdsoft Posted February 12, 2019 Share Posted February 12, 2019 This hook does not automatic apply for any controllers. Prestashop wrote it in controller.php, so if you want use it, you can call it But it is NOT automatic called for every controller, Example, you can open file: classes\controller\ProductListingFrontController.php and see line: $this->ajaxDie(json_encode($this->getAjaxProductSearchVariables())); Link to comment Share on other sites More sharing options...
Tu Chu Posted February 12, 2019 Author Share Posted February 12, 2019 Thanks tdsoft, Yep, I know, this hook just call in controller which call ajaxDie function. I test it in Cart controller, when increasing or decreasing quantity of to be ordered item on the Cart checkout screen. Link to comment Share on other sites More sharing options...
joseantgv Posted February 12, 2019 Share Posted February 12, 2019 48 minutes ago, tdsoft said: This hook does not automatic apply for any controllers. Prestashop wrote it in controller.php, so if you want use it, you can call it But it is NOT automatic called for every controller, Example, you can open file: classes\controller\ProductListingFrontController.php and see line: $this->ajaxDie(json_encode($this->getAjaxProductSearchVariables())); But ajaxDie function call this hook: protected function ajaxDie($value = null, $controller = null, $method = null) { if ($controller === null) { $controller = get_class($this); } if ($method === null) { $bt = debug_backtrace(); $method = $bt[1]['function']; } /* @deprecated deprecated since 1.6.1.1 */ Hook::exec('actionAjaxDieBefore', array('controller' => $controller, 'method' => $method, 'value' => $value)); /** * @deprecated deprecated since 1.6.1.1 * use 'actionAjaxDie'.$controller.$method.'Before' instead */ Hook::exec('actionBeforeAjaxDie'.$controller.$method, array('value' => $value)); Hook::exec('actionAjaxDie'.$controller.$method.'Before', array('value' => $value)); die($value); } 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