Magento: get custumer detail

Get Logged In Customer’s Details

/* Check if the customer is logged in or not */
if (Mage::getSingleton('customer/session')->isLoggedIn()) 
{
	/* Get the customer data */
	$customer = Mage::getSingleton('customer/session')->getCustomer();
	/* Get the customer's full name */
	$fullname = $customer->getName();
	/* Get the customer's first name */
	$firstname = $customer->getFirstname();
	/* Get the customer's last name */
	$lastname = $customer->getLastname();
	/* Get the customer's email address */
	$email = $customer->getEmail();
	
	$tel = $customer->getPrimaryBillingAddress()->getTelephone();
}

Get Guest Customer’s Details

/* Get the guest data */
$order = Mage::getSingleton('sales/order');

/* Get the customer's full name */
$fullname = $order->getBillingAddress()->getName(); 
/* Get the customer's first name */
$firstname = $order->getBillingAddress()->getFirstname();
/* Get the customer's last name */
$lastname = $order->getBillingAddress()->getLastname();
/* Get the customer's email address */
$email = $order->getBillingAddress()->getEmail();
/* Get the customer's telephone number*/
$tel = $order->getBillingAddress()->getTelephone();

posted @ 2014-11-25 10:07  killent  阅读(120)  评论(0)    收藏  举报