Magento – Get customer details from customer id
Get customer details from customer id : This post is use for get detail from customer id in Magento. In this post we get customer id and pass to function get_customer_detail, It will gt all detail of added Customer.
// function to get user detail
function get_customer_detail($customer_id)
{
// Magento Get customer details
// get current user daail
$_customer = Mage::getModel('customer/customer')->load($customer_id);
// remove comments for show all detail of Customer
// echo "<pre>";
// print_r($_customer);
// echo "</pre>";
// basic detail of customer
$_customer->getPrefix();
$_customer->getName(); // Full Name
$_customer->getFirstname(); // First Name
$_customer->getMiddlename(); // Middle Name
$_customer->getLastname(); // Last Name
$_customer->getSuffix();
// other customer detail
$_customer->getWebsiteId(); // get ID of website/store
$_customer->getEntityId(); // get Entity Id
$_customer->getEntityTypeId(); // get Entity Type Id
$_customer->getAttributeSetId(); // get Attribute Set Id
$_customer->getEmail(); // get customer email Id
$_customer->getGroupId(); // get customer Group Id
$_customer->getStoreId(); // get customer Store Id
$_customer->getCreatedAt(); // get
$_customer->getUpdatedAt(); // yyyy-mm-dd hh:mm:ss
$_customer->getIsActive(); // customer is active 1 or 0(not active)
$_customer->getDisableAutoGroupChange();
$_customer->getTaxvat();
$_customer->getPasswordHash();
$_customer->getCreatedIn(); // Admin
$_customer->getGender(); // get customer Gender
$_customer->getDefaultBilling(); // ID
$_customer->getDefaultShipping(); // ID
$_customer->getDob(); // get customer Dob (yyyy-mm-dd hh:mm:ss)
$_customer->getTaxClassId(); // ID
}
// add customer id
$customer_id = "17";
// call function for get detail from customer id
get_customer_detail($customer_id);