Magento : Create Customer programmatically

You can create a customer programmatically in Magento by given sample code:

<?php // create a customer in Magento

$websiteId = Mage::app()->getWebsite()->getId();

$store = Mage::app()->getStore(); $customer = Mage::getModel(‘customer/customer’);

$customer->website_id = $websiteId; $customer->setStore($store);

$customer->setFirstname(‘FirstName’);

$customer->setLastname(‘Lastname’);

$customer->email = “test@yourdomain.com”;

$customer->password_hash = md5(“testpassword”);

$customer->save();

?>

Leave a Reply