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?

  • where you are calling your observer? After placing order? – Abhishek Panchal Nov 28 '17 at 20:49
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.

  • 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? – Thomas Schott Nov 29 '17 at 8:41
  • the street I got in the end with $street=$item->getStreet(-1); – Thomas Schott Nov 29 '17 at 12:39

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.