SergMi Posted September 17, 2018 Share Posted September 17, 2018 Hello, In my module i use next code header('Content-Type: application/json'); Received the following comment from prestashop team The use of function header() is forbidden; use Tools::redirect() or Tools::redirectLink() instead header('Content-Type: application/json'); Tell me how to properly replace this line on Tools::redirect() Thank you in advance Link to comment Share on other sites More sharing options...
Rolige Posted September 17, 2018 Share Posted September 17, 2018 Of course, you can't change the header of the page, can you tell us what are you trying to do? Link to comment Share on other sites More sharing options...
SergMi Posted September 18, 2018 Author Share Posted September 18, 2018 Yes, of course this line used for module "Compare" This used for action add, remove or remove all products Example of use function with "header' public function processRemoveAll() { header('Content-Type: application/json'); $productsIds = array(); $productsIds = Tools::jsonEncode($productsIds, true); $this->context->cookie->__set('brilliantCompare', $productsIds); $this->ajaxDie(Tools::jsonEncode(array( 'success' => true, 'data' => [ 'message' => $this->module->l('All products removed','actions'), 'type' => 'removedAll', 'view' => $this->module->l('View compare','actions') ] ))); } Link to comment Share on other sites More sharing options...
Rolige Posted September 18, 2018 Share Posted September 18, 2018 Ok, you need call it from an external call, not inside the module, or by ajax. Link to comment Share on other sites More sharing options...
SergMi Posted September 20, 2018 Author Share Posted September 20, 2018 On 18.09.2018 at 8:39 PM, Rolige said: Ok, you need call it from an external call, not inside the module, or by ajax. Sorry, but I'm a novice developer, could you please explain in more detail what needs to be done. Thank you in advance 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