0

I have customers from an other shop system I need to import into Magento. Those customers come as SQL table.

I found this old question. Where clockworkgeek advices to import the user using Mage function:

$newCustomer = Mage::getModel('customer/customer');
$newCustomer->setFirstname('Foo')
            ->setLastname('Bar')
            ... // Set all the various details here
            ->save();

Since this is from 2010 I wonder: Is this still a legit way?

In other projects I have worked with AvS_FastSimpleImport. Would that be the preferred method?

2 Answers 2

1

I am a fan of using FastSimpleImport for import of customer, products or categories. They provide good support and it is very flexible when you are dealing with a custom data structure.

You can use the customer model if you like maybe a good idea is to build a data set-up script inside a module that reads from one database and saves to the other.

From my point of view I would suggest:

  1. Building a real import process if this is likely to have to be run multiple times,
  2. Using a data script if it is a one off import process,
1

Its up to you and your needs. The approach you posted here is valid and is one of the most flexible in my opinion one since you can control almost every aspect of the import and the mapping between Magento and your customer registry.

You can also search for import customers via csv here and you will find another approach. Exporting customers from the built in Magento module is a good place to start since that is the structure Magento accepts when importing.

As for the extension, you should check the code. They probably are using the programatically approach you wrote here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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