客户姓名在Magento订单确认不完整 [英] Customer name incomplete on order confirmation in Magento

查看:223
本文介绍了客户姓名在Magento订单确认不完整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在项目期间加入以下内容:

Came accros the following during a project:

客户在结帐时填写姓名:**名字中文姓氏**

发送的确认邮件包含不完整的名称,形式为**名字姓氏**在确认的第一句

Customer fills out his/her name during checkout: **Firstname Middlename Lastname**
The confirmation email sent contains incomplete name in the form of "**Firstname Lastname**" on the first sentence of the confirmation

我看了邮件模板和功能order.getCustomerName()似乎没有检索所有信息。

I looked at the mail templates and the function order.getCustomerName() does not seem to retrieve all the information.

请指教;)

还可以看出这一个。对于有同样问题的人来说,解决方案是:

Figured this one out as well. For people having the same issue here is the solution:

FYI:这是Magento 1.5.1.0

FYI: This is for Magento 1.5.1.0

在事务电子邮件中,函数order.getCustomerName()不完整。
该函数位于Mage_Sales_Model_Order类中,位于:

In the transactional email the function order.getCustomerName() is incomplete. The function is located in class Mage_Sales_Model_Order which is located in:

app/code/core/Mage/Sales/Model/Order.php

我做了一个模型重写扩展Mage_Sales_Model_Order并重写getCustomerName()如下: / p>

I did a model rewrite extending Mage_Sales_Model_Order and rewriting getCustomerName() as following:

class [Namespace]_Sales_Model_Order extends Mage_Sales_Model_Order { //Mage_Sales_Model_Abstract

    public function getCustomerName()
    {
        if ($this->getCustomerFirstname()) {
            $customerName = $this->getCustomerFirstname() . ' ';

            //check if middlename is present and contains value
            //if so: append to $customerName
            if($this->getCustomerMiddlename() && ($this->getCustomerMiddlename() != '')) {

                $customerName .= $this->getCustomerMiddlename() . ' ';

            }

            $customerName .= $this->getCustomerLastname();

        }
        else {
            $customerName = Mage::helper('sales')->__('Guest');
        }

        return $customerName;

    }//end: getCustomerName()

}

像一个魅力一样工作;)

Works like a charm ;)

有关覆盖模型/核心代码的更多信息:

For more info on overwriting models/core code:

Magento - 重写模型,阻止或帮助

干杯:)

推荐答案

这个在admin的客户地址设置中。

You can set this in the customer address settings of admin.

管理 - >系统 - >配置 - >客户配置 - >名称和地址选项 - >显示中间名(初始)。

Admin -> System -> configuration -> Customer Configuration -> Name and Address Options -> Show Middle Name (initial).

显示比模板中的初始内容,您将不得不进一步调查。在英国,我们保持简单的形式,不要中间名。

Showing more than the initial in the templates is something you will have to investigate further. In the UK we keep the form simple and don't ask middle names.

这篇关于客户姓名在Magento订单确认不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆