Friday 4 July 2014

How to Create new Customer in magento or update customer info in magento

$customer = Mage::getModel('customer/customer');
$password = '123456';
$email = 'sanjay@rao.com';
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($email);

if(!$customer->getId()) {
    $customer->setEmail($email);
    $customer->setFirstname('Sanjay');
    $customer->setLastname('Rao');
    $customer->setPassword($password);
}
try {
    $customer->save();
    $customer->setConfirmation(null);
    $customer->save();
    //Make a "login" of new customer
    Mage::getSingleton('customer/session')->loginById($customer->getId());
}
catch (Exception $ex) {
    Zend_Debug::dump($ex->getMessage());
}



No comments:

Post a Comment

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...