How to obtain the latest order number in opencart?

Hello!
As in category.tpl to get the last order number in opencart?

Tried it before, but something does not work:

$orderLast = $this->db->query("SELECT * FROM `order` ". "ORDER BY `order`.`order_id` DESC LIMIT 1");
ESO $orderLast;
?>
July 8th 19 at 11:25
1 answer
July 8th 19 at 11:27
of course it does not, the result need to be processed before returning
Wrote the code simpler:
$last_id = $this->db->query("SELECT MAX(order_status_id) FROM" . DB_PREFIX . "order_status");
echo $last_id;
?>
In the variable $last_id should be only one value, not an array, but the browser shows: "Object of class stdClass could not be converted to string" - arnoldo.Hans commented on July 8th 19 at 11:30
: that's what You think, in fact, the function will return a mysqli_result object. php.net/manual/ru/mysqli.query.php - manuel commented on July 8th 19 at 11:33
: What's the array appears if I write code that get the maximum value of the field "order_status_id" from the table "order_status". The maximum value there is one - arnoldo.Hans commented on July 8th 19 at 11:36
in documentation everything is written - manuel commented on July 8th 19 at 11:39

Find more questions by tags OpenCart