I have a public function in php page like this
public function _getProductID($id_product)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_product` FROM `'._DB_PREFIX_.'packing_product` WHERE `id_product` = '.(int)$id_product);
}
public function hookDisplayProductAdditionalInfo($params)
{
$id_shop = Context::getContext()->shop->id;
$products = $this->_getProducts($id_shop);
$this->context->smarty->assign([
'products' =>$products,
'page' =>$this,
]);
return $this->display(__FILE__, 'product.tpl');
}
I also have a .tpl file (product.tpl) with a script like this
{foreach from=$products item=p}
{assign var='id_Product' value=$page->_getProductID($p.id_product)}
{/foreach}
but the result is an error with notes like this:
Fatal error: Uncaught Error: Cannot use object of type Extlink as array in
however in the back office page it works fine..
Which script code do I need to fix?