hypnootik Posted June 29, 2016 Share Posted June 29, 2016 (edited) HiI am trying to build a module that creates xml file from invoice every time invoice is created.So far the best I came up with is this function in my module. public function hookActionPaymentConfirmation ($params) { $this->hookActionOrderStatusUpdate($params); } public function hookActionOrderStatusUpdate($params) { $order = new Order((int)$params['id_order']); And it executes my module when I change the order status to "payment accepted". Unfortunately I do not get any invoice data ($params) on the first time order status is updated to "payment accepted". I do get the invoice data eventually but only when I chanee order status for the second time. Order Object ( ...... [invoice_number] => 0 I presume this hook is called before invoice is actually generated and therefore I get nothing from $params and are unable to generate xml.What is the correct way to trigger function and get the invoice data? Edited June 29, 2016 by hypnootik (see edit history) Link to comment Share on other sites More sharing options...
hypnootik Posted June 30, 2016 Author Share Posted June 30, 2016 Found the solution for my problem.I was using wrong Hook.The correct hook is actionOrderStatusPostUpdate instead of actionOrderStatusUpdate It is so unfortunate that all this information is lacking from PS official documentation.Would have been so easy, but instead I had to google my way out of this 1 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