Php 如何在模板中显示来自prestashop模块的值
如何在Php 如何在模板中显示来自prestashop模块的值,php,templates,module,prestashop,Php,Templates,Module,Prestashop,如何在div中的prestashop模板页面中显示变量,因为它现在位于页面顶部 public function hookDisplayCustomerAccount() { global $smarty; $userid = $this->context->customer->id; $sql = "SELECT SUM(total_paid) FROM ps_orders WHERE id_customer = '$userid' AND current_
div
中的prestashop模板页面中显示变量,因为它现在位于页面顶部
public function hookDisplayCustomerAccount()
{
global $smarty;
$userid = $this->context->customer->id;
$sql = "SELECT SUM(total_paid) FROM ps_orders WHERE id_customer = '$userid' AND current_state = '1' ";
$result = Db::getInstance()->ExecuteS($sql);
$custdata=array();
$sum = 0;
foreach ($result as $row)
{
/* $custdata[] = array(
"id_order" => round( $row['SUM(total_paid)'] ,2),
);*/
echo round( $row['SUM(total_paid)'] ,2);
}
//$this->context->smarty->assign("custdata", $custdata);
}
}
尝试在模板页面中所需的位置调用钩子,如下所示
{hook h='displayCustomerAccount'mod='yourmodulename'}
PS:如果displayCustomerAccount上只挂接了此模块,则可以排除“mod”
干杯:)