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?
    – Th. Schott
    Commented Nov 29, 2017 at 8:41
  • the street I got in the end with $street=$item->getStreet(-1);
    – Th. Schott
    Commented Nov 29, 2017 at 12:39
  • how to add this? need to create observer?
    – User0434
    Commented May 27, 2020 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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