matoola Posted July 7, 2014 Share Posted July 7, 2014 Hi, I have a module which triggers with ActionValidateOrder hook but can't seem to get invoice number even though it is generated? I tried this but it's empty: $invoice = $params['order']->invoice_number; is there another way to do it? thanks so much, Matej Link to comment Share on other sites More sharing options...
bellini13 Posted July 7, 2014 Share Posted July 7, 2014 The ActionValidateOrder hook is fired before the "Payment Accepted" status is set, and therefore the invoice_number is not available to you during this hook. You would have to edit the PaymentModule class, and move the hook execution below the code that set the order status and reloads the order object. You could also use a different hook "actionPaymentConfirmation", which will get triggered when the order status changes to "Payment Accepted", which typically happens during the creation of a new order. Just keep in mind that it could also happen at other times as well, like from the back office order detail page. 1 Link to comment Share on other sites More sharing options...
matoola Posted July 7, 2014 Author Share Posted July 7, 2014 It works! I just moved execution like you advised and it works. Thanks! 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