1

I need to get the account details of a registered customer and use them in the invoice PDF. The customer belongs to customer group "testgroup". By using the order details I can get the customer group and check if the customer belongs to "testgroup".

How do I get the customer ID and the rest of the account details?

1

Given $order, I can get the email from the order like this:

$customer_email = $order->getCustomerEmail();

Then I can get the account details with the following code:

$customer = Mage::getModel("customer/customer"); 
$customer->setWebsiteId(Mage::app()->getWebsite()->getId()); 
$customer->loadByEmail($customer_email); 
echo $customer->getId(); 
echo $customer->getFirstName(); 
print_r($customer->getData());  

Credit: http://www.techdilate.com/code/magento-get-customer-details-by-email-id/

| improve this answer | |
0
$customer = Mage::getSingleton('customer/session')->getCustomer();
    $customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
    $address = Mage::getModel('customer/address')->load($customerAddressId);
    $fullname = $customer->getName();
    $firstname = $customer->getFirstname();
    $lastname = $customer->getLastname();
    $email = $customer->getEmail();
    $taxvat = $customer->getTaxvat();
    $tele = $customer->getTelephone();
    $telephone = $address->getTelephone();
    $street = $address->getStreet();
    $City = $address->getCity();
    $region = $address->getRegion();
    $postcode = $address->getPostcode();
| improve this answer | |

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.