Casper_O Posted April 20, 2016 Share Posted April 20, 2016 (edited) Im currently looking into automation of our stores since we spend a lot of time of diffrent taskes that could be done with a "one click" action. My issues is that when we update the order to shipped we would like to capture the transactions in the gateway our customer have paid with. After a little research in the core files and how Bulk status update works it seemed to us like we should be able to use "actionOrderStatusUpdate" hook to check everything before we change the status of the order. An we can check with our gateway and collect the paid amount by automatic but the biggest issue for us is that if we for some reason fails to capture the money, the order is still changed to "shipped". is it possible somehow to prevent the update of the order when our check fails in actionOrderStatusUpdate ? public function hookActionOrderStatusUpdate($params) { $order = new Order($params['id_order']); if($order->module = "gateway" && $params['newOrderStatus']->id = Configuration::get('PS_OS_SHIPPING')) { // Here goes our code for checks if fails it should stop update of status. // It sets $ok to true/false depending on if the payment is captured. if(!$ok) { $this->context->controller->errors[] = sprintf(Tools::displayError('ORDER: #%d. CAPTURE ERROR!', $params['id_order']); //Stop updating of this orders status } } } Edited April 20, 2016 by Casper_O (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted April 20, 2016 Share Posted April 20, 2016 No that does not seem to be possible. The actionOrderStatusUpdate hook is intended to notify modules that the order status is going to be changed, but does not provide any method to prevent the status from being changed. Then there is actionOrderStatusPostUpdate, which is executed after the status is changed. Looks like you might have to create an override of the process so that you could prevent the status from changing if the capture fails. Link to comment Share on other sites More sharing options...
Casper_O Posted September 26, 2016 Author Share Posted September 26, 2016 (edited) Then there is actionOrderStatusPostUpdate, which is executed after the status is changed. The thing is, i really did like to do it before the status really changes and if case the payment do not meet the requirement for some reason. That could be an Employee changed the cart content, so the total order do not match the amount authorized by the payment gateway. I might look into the dynamic Hooks, like hookActionObjectOrderHistoryAddBefore and maybe it would be possible that way to change or cancel the order status update. Question is then just if it woud also prevent the system from sending out emails or not. Edited September 26, 2016 by Casper_O (see edit history) Link to comment Share on other sites More sharing options...
latelier-tech Posted March 6, 2017 Share Posted March 6, 2017 I have a similar issue. I'm making a third party API call in a hookActionOrderStatusUpdate and depending on the result, I would like to proceed the status update or stop it with an error. Casper_O, Did you manage to get something ? Link to comment Share on other sites More sharing options...
shon Posted April 29, 2019 Share Posted April 29, 2019 (edited) Hi, I add my question here because the title is quite inherent in what I would like to ask. My intention is to prevent certain "employees" from changing the status order when it has been changed (eg on "shipped") by the Admin. Is it possible to set this block? I'm talking about Prestashop 1.7.5 Edited April 29, 2019 by shon (see edit history) 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