0

我按照帮助指南将 trustpilot 的 SFA 集成到 prestashop 中,他们的指南基于发送订单确认。发送订单确认后,trustpilot 服务会收到一封密件抄送电子邮件,并将该电子邮件添加到发送队列以请求审核。问题可能是:

1) 订单完成但付款失败 > 邮件已发送 2) 订单已完成并付款正常但客户想删除订单 > 电子邮件已发送

因此解决方案是在订单发货状态达到时发送密件抄送电子邮件。当后台操作员手动更改发货状态时,客户将收到发货的模板电子邮件。

我不是 prestashop 覆盖和编程方面的专家,所以我尝试像这样覆盖 mail.php 类:

<?php

class Mail extends MailCore
{

public static function Send($id_lang, $template, $subject, $template_vars, $to,
        $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
        $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null)
{
    // add trustpilot SFA 2.0
    if($template == 'shipped')
    {
        $bcc->addBcc('*********@invite.trustpilot.com');
    }      

    // send to customer
    $ret = parent::Send($id_lang, $template, $subject, $template_vars, $to, $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop, $bcc, $reply_to);
    return $ret;
}
?>

我不知道这是否正确,但在制造混乱之前我需要任何帮助:)

谢谢

4

1 回答 1

0

我以 thsi 工作解决方案结束。我在这里发布代码,所以如果有人需要这种方式正在工作:

<?php
/*
 MODIFIED VERSION TO SUPPORT TRUSTPILOT SEND ON SHIPPED STATUS CHANGE
*/

class Mail extends MailCore
{

    public static function Send($id_lang, $template, $subject, $template_vars, $to,
        $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
        $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null)
    {

        if($template == 'shipped') { $bcc = array('xxxx@invite.trustpilot.com'); }

        return parent::Send($id_lang, $template, $subject, $template_vars, $to,
            $to_name, $from, $from_name, $file_attachment, $mode_smtp,
            $template_path, $die, $id_shop, $bcc, $reply_to);

    }

}

现在我只有一个问题: shipping.html 没有 {mail} 占位符。我如何覆盖 AdminOrdersController.php 让我允许在邮件模板中添加一个新的 {mail} 占位符?

于 2017-07-11T16:51:34.093 回答