1$id_group = array();
2$id_group_pos = array();
3
4// Obtain a list of columns
5foreach ($product_list as $key => $row) {
6 $id_group[$key] = $row['id_group'];
7 $id_group_pos[$key] = $row['id_group_pos'];
8}
9
10// Sort the product_list with id_group ascending then id_group_pos ascending
11array_multisort($id_group, SORT_ASC, $id_group_pos, SORT_ASC, $product_list);