hakeryk2 Posted November 25, 2016 Share Posted November 25, 2016 (edited) Hello, I am developing my first module and I would love to know if there is any prebuild function that is checking history of statuses for order. If not how to write one? Any help? EDIT I created function like this public function getStatusHistory($id) { $sql = 'SELECT `id_order_state` FROM `'._DB_PREFIX_.'order_history` WHERE `id_order`='.$id; $status_array = array(); if ($results = Db::getInstance()->ExecuteS($sql)) foreach ($results as $row) $status_array[] = $row['id_order_state']; return $status_array; } And it works but maybe someone knows better method or can improve mine it will be cool. Edited November 25, 2016 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted November 25, 2016 Share Posted November 25, 2016 The Order class has a function getHistory $order = new Order($id); if (Validate::isLoadedObject($order)) return $order->getHistory($order->id_lang); 1 Link to comment Share on other sites More sharing options...
hakeryk2 Posted November 25, 2016 Author Share Posted November 25, 2016 (edited) Tkank You, I will check it and adapt it to my code. EDIT: How now can I check if there is something in this history? In my old code I had if in_array(4,$order_status_history) then something but right now how should I check that this var contains something? Edited November 25, 2016 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
ventura Posted November 25, 2016 Share Posted November 25, 2016 You can filter by id order state in the function, eg getHistory($order->id_lang,4,false); 4 it is the id orderstate 1 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