Magento查看“公司名称"而不是名字/姓氏 [英] Magento View 'Company Name' Instead Of First/Last Name

查看:54
本文介绍了Magento查看“公司名称"而不是名字/姓氏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Magento可以通过他们的联系人姓名来查看/管理我们的客户,从而轻松地找到他们吗?它用于B2B,因此当电子邮件发送出去时,他们正在拉顾客的名字,而不是更合适的公司名称.

Can Magento view/manage our customers by their business name in addition to their contact names to find them easily? It is being used for B2B, so when emails go out they are pulling the customer’s name, instead of the company name which is more appropriate.

这是全局设置吗?

提前谢谢.

推荐答案

默认情况下,Magento将公司名称存储在客户的地址上,因此很难找到它.

Magento stores business name on the customer's address by default, so it's a little harder to get to.

没有理由您不能添加另一个客户字段来将公司名称放在客户记录本身上.这样一来,您就可以毫无问题地访问它,并且可以更改系统中的其他屏幕来反映它.

There's no reason you cannot add another customer field to put the company name on the customer record itself. That way you'll have no problem accessing it, and can change other screens in the system to reflect it.

如果您不想花费那么多的时间,可以始终实施一种方法,该方法将从默认地址中提取公司名称,并默认将其保存到会话中,以便于检索.

If you don't want to go to those lengths, you could always implement a method that pulls the company name from the default address, and save it into the session by default, for easier retrieval.

更好的主意.

浏览销售电子邮件模板,可以使用两种方法来获取客户的姓名:

Looking through the sales email templates, there are two methods that are used to grab a customer's name:

$order->getCustomerName();
$order->getBillingAddress()->getName();

我没有看到对公司名称的单独引用,因此您应该可以将这两种方法替换为自己的方法,并获得理想的结果.您将需要创建自己的模块,并覆盖客户/地址和销售/订单的模型(其他人在其他地方对此进行了深入介绍).然后创建如下所示的方法:

I don't see any separate references to the company name, so you should be able to substitute these two methods for your own and get the desired outcome. You'll need to create your own module and override the models for customer/address and sales/order (others have covered this in depth elsewhere). Then create methods that look something like this:

public function getCustomerName() {
    if($this->getBillingAddress()->getCompany()) {
        return $this->getBillingAddress()->getCompany();
    }

    return parent::getCustomerName();
}

这是销售订单的示例,为客户进行相应的修改.现在,您的公司名称将在可用时使用,而当公司名称不可用时,将使用原始公司名称(客户名称).

That's the example for sales order, modify accordingly for customer. Now your company names will be used whenever available, and when they aren't the fallback will be to the original implementation (customer name).

希望有帮助!

谢谢,乔

您对通用应用程序是正确的.如果您只想要电子邮件,则要考虑的是,是否可以在需要的地方访问自定义功能.如果没有方便的对象,那么我不能肯定您将只能调用所需的任何方法.

You are correct about the universal application. If you did want just the emails, the concern is whether you have access to your custom function where you need it. If there's no object handy, I'm not positive that you will be able to call just any method that you need to.

在这种情况下有效的方法是重写下面提到的两个对象,而向它们添加一个getCompanyName方法.这样,您就可以调用正确的对象,并且可以专门编辑电子邮件以进行品尝.

An approach that would work in this case would be to override the two objects mentioned below, but to instead add a getCompanyName method to them. That way, you'll have the right objects to call, and you can edit the emails specifically to taste.

这篇关于Magento查看“公司名称"而不是名字/姓氏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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