dtotwai720621 2014-08-01 09:11
浏览 50
已采纳

Magento - 订购电子邮件的自定义主题

I have a service in PHP which interacts with a Magento website. I can't access the source code of this website. So I can use service to order a product and send a mail. When I call

$order->sendNewOrderEmail();

an email will be send to my email-id with subject Nuovo ordine # XXXXXXXXX.

Now I want add a string to this subject: TEST - Nuovo ordine # XXXXXXXXX.

How I can do it?

  • 写回答

1条回答 默认 最新

  • dongzuan4491 2014-08-01 09:57
    关注

    In app/code/core/Mage/Sales/Model/Order.php find sendNewOrderEmail() method. Then find

        $mailer->setTemplateParams(array(
                'order'        => $this,
                'billing'      => $this->getBillingAddress(),
                'payment_html' => $paymentBlockHtml
            )
        );
    

    Here is array of variables from template. Add one new param for test:

                'test'         => $is_test ? $is_test : ''
    

    Change $is_test to your condition. For example:

    public function sendNewOrderEmail($is_test = FALSE)
    

    Now open your template file app/locale/en_US/template/email/sales/order_new_guest.html (for example).

    Find subject variable on the first line: <!--@subject Nuovo ordine # {{var order.increment_id}} @--> or something like this.

    Make changes: <!--@subject {{var is_test}}Nuovo ordine # {{var order.increment_id}} @-->

    Call method:

    $order->sendNewOrderEmail('TEST - ');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?