'How to display a list of users in Opencart 3
I don't have enough knowledge. I found an example for admin\model\sale\order.php But I don't understand what should be specified in the file admin\controller\sale\order.php Please tell me which is correct.
public function getUsers() {
$sql = "SELECT user_id, firstname, lastname FROM " . DB_PREFIX . "user WHERE status=1";
$re = $this->db->query($sql);
$user_data = array();
foreach ($re->rows as $row) {
$user_data [$row['user_id']] = $row['firstname'] . " " . $row['lastname'];
}
return $user_data;
}
Solution 1:[1]
in admin\controller\sale\order.php you should load model file and retrieve data:
$this->load->model('sale/order');
$user_info = $this->model_sale_order->getUsers();
//////////
echo '<pre>'; print_r($user_info); echo '</pre>';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | K. B. |
