在电子邮件中添加自定义字段Opencart

时间:2017-05-21 21:53:13

标签: php mysql opencart opencart2.x

我正在使用Opencart 2.1.0.1。我在注册页面上添加了一些自定义字段。如何在发送给商店管理员的电子邮件中显示这些自定义字段?

以下是标准字段的代码:

// Send to main admin email if new account email is enabled
    if ($this->config->get('config_account_mail')) {
        $message  = $this->language->get('text_signup') . "\n\n";
        $message .= $this->language->get('text_website') . ' ' . html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8') . "\n";
        $message .= $this->language->get('text_firstname') . ' ' . $data['firstname'] . "\n";
        $message .= $this->language->get('text_lastname') . ' ' . $data['lastname'] . "\n";
        $message .= $this->language->get('text_customer_group') . ' ' . $customer_group_info['name'] . "\n";
        $message .= $this->language->get('text_email') . ' '  .  $data['email'] . "\n";
        $message .= $this->language->get('text_telephone') . ' ' . $data['telephone'] . "\n";

1 个答案:

答案 0 :(得分:0)

在电子邮件中添加自定义字段以及现有字段。

$message .= $this->language->get('text_custom_field') . ' ' . $data['custom_field'] . "\n";

现在在catalog / language / en-gb / mail / customer.php

中添加自定义字段文本
$_['text_custom_field']          = 'Custom field:';

如果从前端格式传递,您将获得$ data ['custom_field']值。