Import/Export Customers with Ids From Dataflow-Profile in Magento

Topics focus on Web Developments, Programming, Database, Digital Marketing Tutorials, Code Snippets, SEO, Social Media Marketing and Inspirational articles.

Import/Export Customers with Ids From Dataflow-Profile in Magento 1

Import/Export Customers with Ids From Dataflow-Profile in Magento

Here, we have written article about How to Import/Export Customers with Ids From Dataflow-Profile in Magento. We explained here step by step import the customers with their ids from old website to Magento Ecommerce site and export to other ecommerce site with customers ids. It will help us to maintain customers with old ids and references like in orders.

Export with Customers ID’s:

Override file: app\code\core\Mage\Customer\Model\Convert\Parser\Customer.php

Find and update function unparse();

previous:

1
2
3
4
5
6
7
foreach ($this->getFields() as $code=>$node)
{
    if ($node->is('system'))
    {
        $systemFields[] = $code;
    }
}

after update:

1
2
3
4
5
6
7
foreach ($this->getFields() as $code=>$node)
{
    if ($node->is('system') && strpos('entity_id',$code)===false)
    {
        $systemFields[] = $code;
    }
}

Import with Customers ID’s:

To import CSV files from Dataflow – Profile, First of all you have to query on database for avoiding database related constraint error before Import CSV.

1
2
3
->ALTER TABLE `customer_address_entity` DROP FOREIGN KEY FK_CUSTOMER_ADDRESS_ENTITY_PARENT_ID_CUSTOMER_ENTITY_ENTITY_ID;
 
->ALTER TABLE `customer_entity_varchar` DROP FOREIGN KEY FK_CUSTOMER_ENTITY_VARCHAR_ENTITY_ID_CUSTOMER_ENTITY_ENTITY_ID;

After Importing CSV files you have to fire query on database for add database constraints:

1
2
3
4
5
->ALTER TABLE `customer_address_entity_varchar` ADD CONSTRAINT FK_CUSTOMER_ENTITY_VARCHAR_ENTITY_ID_CUSTOMER_ENTITY_ENTITY_ID
FOREIGN KEY (`entity_id`) REFERENCES `customer_address_entity`(`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE;
 
->ALTER TABLE `customer_address_entity` ADD CONSTRAINT FK_CUSTOMER_ADDRESS_ENTITY_PARENT_ID_CUSTOMER_ENTITY_ENTITY_ID
FOREIGN KEY (`parent_id`) REFERENCES `customer_entity`(`entity_id`) ON DELETE SET NULL ON UPDATE CASCADE;

That’s End.

One comment

Add comment


 

Pin It on Pinterest

Share This