klimpond Posted July 23, 2013 Share Posted July 23, 2013 Hello, I would like to ask you, if it is possible to display a hook action result message in BackOffice. I created 'ActionOrderStatusPostUpdate' hook function in my module and when all needed operations are performed I would like to inform user (employee in BackOffice) who changed the order status if the hook execution was successful or what went wrong. As far as I checked the code, AdminOrderController calls OrderHistory->changeIdOrderState() which executes the transplanted modules 'ActionOrderStatusPostUpdate' hook. But module has no context association to be able to inject error or confirmation message. Please help. Thanks Link to comment Share on other sites More sharing options...
El Patron Posted July 23, 2013 Share Posted July 23, 2013 moving to development section Link to comment Share on other sites More sharing options...
vekia Posted July 24, 2013 Share Posted July 24, 2013 you can for example use var_dump or print_r for your variables to check contents - then use die(); / break(); you will see the contents of the variables - so you will know something more about what's goin wrong this is the my way to debug these hooks and my code Link to comment Share on other sites More sharing options...
klimpond Posted July 24, 2013 Author Share Posted July 24, 2013 Thank you for your answer, but what am I looking for is a user friendly back office solution, where administrator of the shop is informed about action results. After more Prestashop source code digging, I found I can use in my hook functions like $this->context->controller->errors[]; or $this->$this->adminDisplayWarning($msg); which is great, but in my case, after updating order status, there is performed a redirect, and as PHP is stateless, all messages are lost. I was thinking about storing messages to session or cookie and then retrieving them on each page load, where messages are displayed to user and then removed from session/cookie. Has Prestashop similar advanced message capabilities or I have to develop my own? Thank you. Link to comment Share on other sites More sharing options...
vekia Posted July 24, 2013 Share Posted July 24, 2013 ahh thanks for clarification, i just thought that you want to debug the code to find errors i'm going to try something to my bo, i suppose that there is something to display messages, but i don't know exactly right now, so tests are necessary Link to comment Share on other sites More sharing options...
klimpond Posted July 30, 2013 Author Share Posted July 30, 2013 Hello, did you find something which would solve my problem? Thanks again. Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted December 23, 2013 Share Posted December 23, 2013 hi vekia, How to get the order details and current state of the order after changing the status in backoffice. i am using this hook 'ActionOrderStatusPostUpdate' hook. Link to comment Share on other sites More sharing options...
vekia Posted December 23, 2013 Share Posted December 23, 2013 you've got it in $params variable, in this hook try to use this: echo "<pre>".print_r($params)."</pre>";die(); you will see then detailed informations about $params array (where you can find information about your order) use this code only temporarily. Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted December 23, 2013 Share Posted December 23, 2013 Thank you vekia, I am using the hook actionorderstatuspostupdate -> while using this hook i am trying to get the order status of a order, after clicking the add button of status .. i am seeing the array values and it is not showing the currently selected status value, it shows the previous status before clicking the add button or change in the status. how to get the order status value after changing the status by clicking the add button in order page. Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted January 9, 2014 Share Posted January 9, 2014 hi vekia what is the use of this hook hookactionUpdateQuantity, in which scenarios this hooks are used... Link to comment Share on other sites More sharing options...
timo_paul Posted January 23, 2014 Share Posted January 23, 2014 Thank you for your answer, but what am I looking for is a user friendly back office solution, where administrator of the shop is informed about action results. After more Prestashop source code digging, I found I can use in my hook functions like $this->context->controller->errors[]; or $this->$this->adminDisplayWarning($msg); which is great, but in my case, after updating order status, there is performed a redirect, and as PHP is stateless, all messages are lost. I was thinking about storing messages to session or cookie and then retrieving them on each page load, where messages are displayed to user and then removed from session/cookie. Has Prestashop similar advanced message capabilities or I have to develop my own? Thank you. I've the same Problem. Someone an good idea to solve this ? Thanks. Link to comment Share on other sites More sharing options...
toanloau Posted March 15, 2014 Share Posted March 15, 2014 you've got it in $params variable, in this hook try to use this: echo "<pre>".print_r($params)."</pre>";die(); you will see then detailed informations about $params array (where you can find information about your order) use this code only temporarily. in don't see anything from $params: function install() { $this->registerHook('actionProductDelete') } function hookActionProductDelete($params){ echo "<pre>".print_r($params)."</pre>";die(); $file = fopen('D:\testnew_module_delete.txt', 'a+'); fwrite($file, print_r($params,true)); fclose($file); } is what i'm doing wrong? Link to comment Share on other sites More sharing options...
timo_paul Posted March 15, 2014 Share Posted March 15, 2014 Hello, i am new with PrestaShop and my english is not the best, please consider this. in don't see anything from $params: function install() { $this->registerHook('actionProductDelete') } function hookActionProductDelete($params){ echo "<pre>".print_r($params)."</pre>";die(); $file = fopen('D:\testnew_module_delete.txt', 'a+'); fwrite($file, print_r($params,true)); fclose($file); } is what i'm doing wrong? try to use lower-case hook-name, for my examples it works: function hookactionProductDelete($params){ I've the same Problem. Someone an good idea to solve this ? Have Anyone a good Solution ? Best Regards, Timo Link to comment Share on other sites More sharing options...
sondiva Posted December 5, 2015 Share Posted December 5, 2015 Does any one have an idea on what is the hook name for manual admin add order in backoffice so that i can transplant a date and time delivery module, if it is possible many people will be benefitted. Link to comment Share on other sites More sharing options...
Websuvius Posted July 6, 2016 Share Posted July 6, 2016 Thank you for your answer, but what am I looking for is a user friendly back office solution, where administrator of the shop is informed about action results. After more Prestashop source code digging, I found I can use in my hook functions like $this->context->controller->errors[]; or $this->$this->adminDisplayWarning($msg); which is great, but in my case, after updating order status, there is performed a redirect, and as PHP is stateless, all messages are lost. I was thinking about storing messages to session or cookie and then retrieving them on each page load, where messages are displayed to user and then removed from session/cookie. Has Prestashop similar advanced message capabilities or I have to develop my own? Thank you. Same problem here .... have you found a solution? Thanks 1 Link to comment Share on other sites More sharing options...
metroid454 Posted August 9, 2016 Share Posted August 9, 2016 Same problem here .... have you found a solution? Thanks Same here. Any updates? 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