PrestashopEnthu Posted November 9, 2017 Share Posted November 9, 2017 (edited) I have managed to create a form in .tpl and query in admin controller to update a status for "orders" table. The status has been changed in proper and it is displaying correctly. I am using SQL query to update "orders" table. My only concern is that when a status update is made, the order history is not inserted. As such, order history is not updated and overall, it is not a viable solution. I am not using any hooks but I am using a button from a .tpl form. public function postProcess() { if (Tools::isSubmit('submitpaymentvalidated')) { $ids= Tools::getValue('paymentvalidated'); foreach ($ids as $updateids) { $objOrder = new Order($updateids); $history = new OrderHistory(); $history->id_order = (int)$objOrder->id; $history->changeIdOrderState(3, (int)($objOrder->id)); } } Is there built-in function that I can add in along my query to update "order_history"? Am I using the function above correctly? It is updating the query well, just not updating "order_history". Thank you. Edited November 10, 2017 by Enthu86 (see edit history) Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted November 10, 2017 Author Share Posted November 10, 2017 I have added the following codes to solve the error: $history->add(true); $history->save(); Thank you. 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