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()) ?>


<?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.


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


In that block (Mage_Customer_Block_Address_Edit), you need to do $this->getAddress()->getCompany().

If you do $this->getCustomer(), you're getting the customer object, from which you can get addresses a well, but getAddresses() or getShippingAddress() are not valid methods of the customer object. See Mage_Customer_Model_Customer you want to retrieve addresses from this object.

  • I have tried your answer, but this gives me no value in the field, while i do have the company name filled in my current address. – John Mar 17 '15 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.