Jump to content

Prestashop 1.6.1.14 - Order History Update Upon SQL Query


Recommended Posts

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 by Enthu86 (see edit history)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More