Edit prestashop hook code

Job ID: 37418465

Budget: $10 – $30 CAD

these code select only the last product even if the customer order 2 products

public function hookDisplayAdminOrder($params){

$id_order = (int)Tools::getValue('id_order');

$sql1 = 'SELECT product_id from order_detail where id_order = '.(int)$id_order;
$data1 = Db::getInstance()->getRow($sql1);

$prodid = $data1['product_id'];


$sql2 = 'SELECT url from scrape_ali_info where id_product='.$prodid;
$data2 = Db::getInstance()->getRow($sql2);

$this->context->smarty->assign(array(
'id_product' => $id_product,
'ali_url' => $data2['url'],
'id_order' => $id_order
));

return $this->display(__FILE__, 'views/templates/admin/vieworder.tpl');

}

I see only the last product I want to see all product the customer buy.
I need just to edit these code
Related categories: PHP JavaScript Software Architecture Prestashop MySQL