dosc9472 2017-06-22 13:53
浏览 32
已采纳

Prestashop 1.6.1.13和TrustPilot SFA 2.0服务

I followed the help guide to integrate SFA of trustpilot into prestashop, bt their guide is based on sending order confirmation. When order confirmation is sent the trustpilot servie receive a bcc email and add to sending queue the email to ask for a review. The problem could be:

1) Order done but failed payment > mail sent anyway 2) Order done and payed ok but customer wanna delete the order > email already sent

So the solution is to send a bcc email when shipped status of order is reached. When shipped status is manually changed by backoffice operator the customer will receive the shipped template email.

I'm not an expert on prestashop overriding and programming so ii try to make an override to mail.php class like this one:

<?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;
}
?>

I don't know if it is correct, but before creating a chaos i would like any help :)

Thank you

  • 写回答

1条回答 默认 最新

  • dongyun3897 2017-07-11 16:51
    关注

    i ended with thsi working solution. I post here the code so if someone need this way is working:

    <?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);
    
        }
    
    }
    

    Now i've only one problem: the shipped.html don0't have the {mail} placeholder. How i can override the AdminOrdersController.php to let me allow to add a new {mail} placeholder in the mail template?

    Ty

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog