2

I'm performing a large import of an existing customer base from a different platform.

I've exported their DB and written a script to make a CSV to import into Magento 1.9. Unfortunately, we do not have a password. Is there a way to have Magento generate one and send each customer, as we add them, an email to perform a reset? I couldn't find any links on a strategy here.

4

You can write a script that gets all the newly imported customers and then it generates a new password and sends an email to your customers try this:

$customers = Mage::getModel('customer/customer')
    ->getCollection()
    ->addAttributeToFilter(
        'created_at', 
        array('gteq', $dateYouImportedYourCustomers)
    );

foreach ($customers as $customer) {
    /** @var $customer Mage_Customer_Model_Customer */
    if ($customer->getId()) {
        try {
            $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
            $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
            $customer->sendPasswordResetConfirmationEmail();
        } catch (Exception $exception) {
            Mage::log($exception);
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.