1

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.

4

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

1

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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