Hi there!
I need to change the order status and add a history with a external php. (something like file.php?order_id=65489&status=sent)
What file should I include so I can access $this->model_checkout_order->addOrderHistory($order_id, $status, $comment, $notify) ?
I need to change the order status and add a history with a external php. (something like file.php?order_id=65489&status=sent)
What file should I include so I can access $this->model_checkout_order->addOrderHistory($order_id, $status, $comment, $notify) ?
OC version. By following these:Tárraga wrote: ↑Tue Sep 21, 2021 8:13 pmHi there!
I need to change the order status and add a history with a external php. (something like file.php?order_id=65489&status=sent)
What file should I include so I can access $this->model_checkout_order->addOrderHistory($order_id, $status, $comment, $notify) ?
- viewtopic.php?f=202&t=220903#p805005
- https://github.com/opencart/opencart/wiki/Events-System
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
You already have the answer to your question.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
I found out how to do this. Here's my code:
Now I'm trying to get the current order status but I can't find the function that returns that. Any ideas?
Code: Select all
class ControllerCustomStatus extends Controller {
public function index() {
$this->load->model('checkout/order');
$order_id = $this->request->get['id'];
$status = $this->request->get['status'];
$this->model_checkout_order->addOrderHistory($order_id, $status, '', '1');
}
}
Be careful with that code, it would allow anyone to change the status of their order. You would need some sort of access control.
To get the status of an order.
To get the status of an order.
Code: Select all
$order_info = $this->model_checkout_order->getOrder($order_id);
$order_info['order_status_id'];
Tárraga wrote: ↑Wed Sep 22, 2021 1:58 pmI found out how to do this. Here's my code:
Now I'm trying to get the current order status but I can't find the function that returns that. Any ideas?Code: Select all
class ControllerCustomStatus extends Controller { public function index() { $this->load->model('checkout/order'); $order_id = $this->request->get['id']; $status = $this->request->get['status']; $this->model_checkout_order->addOrderHistory($order_id, $status, '', '1'); } }
Code: Select all
$order_id = $this->request->get['id'];
Code: Select all
if (isset($this->request->get['order_id'])) {
$order_id = (int)$this->request->get['order_id'];
} elseif (isset($this->request->post['order_id'])) {
$order_id = (int)$this->request->post['order_id'];
} else {
$order_id = 0;
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
/* Your code here */
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester