Recently I had the challenge to import customers from an existing OsCommerce installation into a new Magento setup. Initially, I tried it the Magento way, but very soon I stumbled upon a little problem: the amount of customers was over the 160.000, and importing it with Magento models would take 4 or 5 days! And then I haven’t even taken the usage of memory in consideration. So I had to look for an alternative to import customers.
Magento Customer Importer
After a small day of hard work I created the Magento Customer Importer: A simple PHP class that would import customers blazing fast into Magento. How? Instead of using Magento, the customers would be imported directly into the database.
And the profit is huge: whereas the import would first take 4 to 5 days, it’s now importing these customers in less than an hour! And for those who like numbers: that’s a factor of 6500 times as fast!
Share the knowledge
I’ve made this customer importer at my job at Happy Online, and since we make use of a lot of open source solutions we sometimes feel like we have to give something back to the community from whom we’ve taken so much. That’s why we decided to make this customer class open source.
You can find the Magento Customer Importer here on GitHub
And if you discovered a bug or added a nice little feature, feel free to fork this mini-project and send a pull request.
Visitors give this article an average rating of 4.0 out of 5.
How would you rate this article?
★ ★ ★ ★ ★
How do I use this code to import customers that I have in a CSV file?
I don’t see much difference in speed. I have 1800000 customers which need to be imported and this script is importing around 1800 records in 20 minutes
Weird. Sounds slow. Tested it, and it’s like 130 customers per second, that would be 20 minutes for your 160k.
You could speed it up with multiple inserts at once.
There are some errors:
1) Field “initials” doesn’t exist in default
2) updateId is not set, should be like
public function import($customerData, $updateId=false)