Magento – Get company name when adding new address

addressformsmagento-1.7shipping-address

I am trying to fill in the field: Company, when adding a new address, retrieving the company name from the current address.

I am editing:
/www.vadotex.biz/web/app/design/frontend/vadotex/default/template/customer/address/edit.phtml

and have tried:

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

and

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

as value of the field.

I want it to copy the company name of the current shipping address, but when using above codes, it wont show me any value, and just cuts off the form.

Best Answer

Try ->getPrimaryShippingAddress() or ->getPrimaryBillingAddress() on the getCustomer() and use ->getCompany()` for the data

Related Topic