Magento : Password encryption for customer data import
I had to transfer k-ecommerce customer data to magento. I created csv file according to magento customer data upload csv that I got from data profile -> export customer profile.
But there was a problem to encrypt password to match with magento. I googled and found this. I will share with others for their reference. Thanks Edward// Change the paths according to your environment
require_once 'app/Mage.php';
umask(0);
$app = Mage::app('default');
// Instantiate the core encryption model
$obj = Mage::getModel('core/encryption');
// Instantiate the core helper
$helper = Mage::helper('core');
//Set the encryptions helper
$obj->setHelper($helper);
umask(0);
$app = Mage::app('default');
// Instantiate the core encryption model
$obj = Mage::getModel('core/encryption');
// Instantiate the core helper
$helper = Mage::helper('core');
//Set the encryptions helper
$obj->setHelper($helper);
// Get the password's hash
$enc_pwd = $obj->getHash($pwd, 2);
// To validate password, use this. It will return 1 if it is correct
echo $obj->validateHash($pwd, $enc_pwd);
Comments