Magento Admin – Get Company Name from Customer Billing Address

customercustomer-address

I am trying to get Company Name to display in Magento admin but I can't get the value for just the Company name and nothing else.

Here is my code

<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>

Can anyone let me know what I've done wrong here?

Best Answer

You can get the company name inside app/design/adminhtml/default/default/template/customer/tab/view.phtml by using the following code:

Getting the company name from the billing address:

<?php echo $this->htmlEscape($this->getCustomer()->getBillingAddress()->getCompany()); ?>

Getting the company name from the shipping address:

<?php echo $this->htmlEscape($this->getCustomer()->getShippingAddress()->getCompany()); ?>
Related Topic