$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