1

I have an Observer for customer registration which sends an email to the admin on success. My registration form has all address fields. Sending the mail works already.

Customer Name, StoreName and Company I have already but I still need the complete address data: street, ZIP, country ,phone, email to send it in my mail. How can I retrieve this data?

Can anyone help?

1
  • where you are calling your observer? After placing order? Commented Nov 28, 2017 at 20:49

1 Answer 1

2
 $customer=Mage::getModel('customer/customer')->load($observer->getEvent()->getCustomer()->getId()); $email=$customer->getEmail(); $address = $customer->getAddresses(); foreach ($address as $item) { $country=$item->getCountry(); $zip=$item->getPostcode(); $street=$item->getStreet(); $telephone=$item->getTelephone(); } } 

You can get the address details like this.

3
  • Thank you very much, it works almost perfect. The only data that does not show as it should is the street, the it prints Array in my mail. Do you know what is the issue with the street? Commented Nov 29, 2017 at 8:41
  • the street I got in the end with $street=$item->getStreet(-1); Commented Nov 29, 2017 at 12:39
  • how to add this? need to create observer? Commented May 27, 2020 at 11:53

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.