Magento View 'Company Name' Instead of the first and last name

Can Magento browse or manage our customers by their name, in addition to their contact names, to make them easy to find? It is used for B2B, so when emails go out, they pull out the name of the customer, not the name of the company, which is more suitable.

Is this a global setting?

early.

+3
source share
1 answer

Magento saves the company name at the customer’s default address, so it’s a bit more difficult to get.

, , . , , , .

, , .


EDIT: .

, , :

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

, . / / ( ). , :

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

    return parent::getCustomerName();
}

, . , , ( ).

, !

,


. , , , . , , , .

, , , , getCompanyName. , , , .

+3

Source: https://habr.com/ru/post/1763931/


All Articles