Skip to content

Instantly share code, notes, and snippets.

@neilbradley
Created May 24, 2017 10:12
Show Gist options
  • Save neilbradley/781ef9933ddfe44b02a6b238da8c657d to your computer and use it in GitHub Desktop.
Save neilbradley/781ef9933ddfe44b02a6b238da8c657d to your computer and use it in GitHub Desktop.
Get Magento Customer by Entity ID
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$customers = Mage::getResourceModel('customer/customer_collection')
->addAttributeToSelect('*') // <- careful with this
->addAttributeToFilter('entity_id', 15701);
foreach ($customers as $customer) {
echo $customer->getPrefix();
echo $customer->getName(); // Full Name
echo $customer->getFirstname(); // First Name
echo $customer->getMiddlename(); // Middle Name
echo $customer->getLastname(); // Last Name
echo $customer->getSuffix();
// All other customer data
echo $customer->getWebsiteId(); // ID
echo $customer->getEntityId(); // ID
echo $customer->getEntityTypeId(); // ID
echo $customer->getAttributeSetId(); // ID
echo $customer->getEmail();
echo $customer->getGroupId(); // ID
echo $customer->getStoreId(); // ID
echo $customer->getCreatedAt(); // yyyy-mm-ddThh:mm:ss+01:00
echo $customer->getUpdatedAt(); // yyyy-mm-dd hh:mm:ss
echo $customer->getIsActive(); // 1
echo $customer->getDisableAutoGroupChange();
echo $customer->getTaxvat();
echo $customer->getPasswordHash();
echo $customer->getCreatedIn(); // Admin
echo $customer->getGender(); // ID
echo $customer->getDefaultBilling(); // ID
echo $customer->getDefaultShipping(); // ID
echo $customer->getDob(); // yyyy-mm-dd hh:mm:ss
echo $customer->getTaxClassId(); // ID
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment