Thứ Hai, 14 tháng 3, 2011

How to get customer First Name, Last Name , Email Address or Details in magento


Before geting the details of a customer you must to have check whether Customer is Logged in or not, If a customer is logged in then only you can get details fo the customer. To check whether user logged in or not click here or you can go to http://xhtmlandcsshelp.blogspot.com/2010/11/magento-check-if-user-logged-in-or-log.html to get the code. Then write the code below to get customer details




$customer = Mage::getSingleton('customer/session')->getCustomer();

$email = $customer->getEmail();// To get Email Id of a customer

$firstname = $customer->getFirstname();// To get Firstname of a customer

$lastnam e= $customer->getLastname();// To get Last name of a customer



Không có nhận xét nào:

Đăng nhận xét