Friday 8 July 2011

Create Customer By Code In Magento

Creating customer programmaticaly is easy just use the code below.

$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
 
//$customer = new Mage_Customer_Model_Customer();
$customer = Mage::getModel("customer/customer");
$customer->website_id = $websiteId; 
$customer->setStore($store);
 
$customer->firstname = "vikram";
$customer->lastname = "singh";
$customer->email = "singh@yourdomain.com";
$customer->password_hash = md5("password");
$customer->save();

No comments:

Post a Comment