better to make another type of approach
Modify the _getProducts function, either by modifying the query to add the _getProductID value, or directly modifying or creating a new array to add a new key. eg
public function hookDisplayProductAdditionalInfo($params)
{
$id_shop = Context::getContext()->shop->id;
$products = $this->_getProducts($id_shop);
$product_with_ids = array();
foreach ($products as $product) {
$id_product_from_db = $this->_getProductID($product['id_product']);
$product_with_ids[] = array_merge($product, ['id_product_from_db' => $id_product_from_db]);
}
$this->context->smarty->assign([
'products' => $product_with_ids
]);
return $this->display(__FILE__, 'product.tpl');
}
in tpl
{foreach from=$products item=product}
{$product.id_product_from_db}
{/foreach}