首页 > 解决方案 > 电子邮件中缺少“$template”参数

问题描述

我正在尝试在我们的 IPN 发送付款状态更新后发送电子邮件,并同时向客户发送电子邮件。我有以下代码

$file_attachement = null; 
Mail::Send( (int)$email_order->id_lang, 
'order_conf', 
Mail::l('Order confirmation', (int)$email_order->id_lang), 
null, 
$email_customer->email, 
$email_customer->firstname.' '.$email_customer->lastname, 
null, 
null, 
$file_attachement, 
null, 
_PS_MAIL_DIR_, false, (int)$email_order->id_shop );

我收到以下错误

Missing '$template' parameter...smarty_internal_templatebase.php on line 177

存在,order_conf我可以查看Advanced Parameters->Email并看到它正在尝试发送。

Prestashop 版本是 1.7.5.1

标签: emailprestashop

解决方案


邮件是模板化的。您必须为模板机制传递数据。

您的数据参数为空。

<?php

$file_attachement = null; 
Mail::Send(
    (int)$email_order->id_lang, 
    'order_conf', 
    Mail::l('Order confirmation', (int)$email_order->id_lang), 
    $YOUR_DATA_ARRAY_NOT_NULL, 
    $email_customer->email, 
    $email_customer->firstname.' '.$email_customer->lastname, 
    null, 
    null, 
    $file_attachement, 
    null, 
    _PS_MAIL_DIR_, false, (int)$email_order->id_shop );

?>

您可以从Prestashop 的源代码中了解如何获取这些数据


推荐阅读