Magento:: How to Export Customer ID with Import/Export Profile

Posted by Damodar Bashyal on March 02, 2012

 

I was struggling to export Customer ID (entity_id) for some time. I thought it should be straight forward. But it wasn't, so after googling for a while I found this solution.

solution 1:

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

and update function unparse();

previous:

$systemFields = array();
foreach ($this->getFields() as $code=>$node)
{
    if ($node->is('system'))
    {
	    $systemFields[] = $code;
    }
}

after update:

foreach ($this->getFields() as $code=>$node)
{
    if ($node->is('system') && strpos('entity_id',$code)===false)
    {
    	$systemFields[] = $code;
    }
}

solution 2:

override file: app\code\core\Mage\Customer\etc\config.xml

previous:

<entity_id><system>1</system><ignore>1</ignore></entity_id>

after update:

<entity_id><!--<system>1</system>--><ignore>1</ignore></entity_id>

solution 3:

But, i did this way:

create file: app\code\community\Technooze\Customer\etc\config.xml

and add this code:

<?xml version="1.0"?>
<config>
    <modules>
        <Technooze_Customer>
            <version>1.0.0</version>
        </Technooze_Customer>
    </modules>
    <global>
        <models>
            <class>Technooze_Customer_Model</class>
            <customer>
                <rewrite>
                    <convert_parser_customer>Technooze_Customer_Model_Convert_Parser_Customer</convert_parser_customer>
                </rewrite>
            </customer>
        </models>
    </global>
</config>

Create file: app\code\community\Technooze\Customer\Model\Convert\Parser\Customer.php

and add this code:

<?php
/*
* updated to print out customer ID.
*/
class Technooze_Customer_Model_Convert_Parser_Customer
extends Mage_Customer_Model_Convert_Parser_Customer
{
    public function getFields()
    {
        if (!$this->_fields)
        {
        	$this->_fields = Mage::getConfig()->getFieldset('customer_dataflow', 'admin');
        }
        if(isset($this->_fields->entity_id))
        {
        	$this->_fields->entity_id->system=0;
        }
        return $this->_fields;
    }
}

Now: create file: Technooze_All.xml if you don't already have.

and add this code:

<?xml version="1.0"?>
<config>
    <modules>
        <Technooze_Customer>
            <active>true</active>
            <codePool>community</codePool>
        </Technooze_Customer>
    </modules>
</config>

Which solution do you prefer? Please post your comment below plus like and follow us.

Bach Chien posted on - Tuesday 13th of March 2012 11:19:47 PM

Of course option 3. Because it is always safe to extend a class instead of overwrite it.

Joshua posted on - Thursday 27th of June 2013 10:37:17 PM

Exported ID's but does not import them. :o(

Raffaele posted on - Wednesday 11th of December 2013 07:40:57 AM

Scusate ma io ho creato questi file e messi nel posto giusto.
Ma ora mi devo creare un nuovo profilo avanzato?
grazie mille

mike posted on - Tuesday 10th of February 2015 03:59:13 AM

same issue here. I can export the entity_id but i cant import my own

Saravanan posted on - Tuesday 24th of February 2015 01:38:08 AM

Is there any way to import with entity ID

john moljin posted on - Friday 15th of January 2016 03:06:58 AM

how do you call the export function after?

Sarah posted on - Wednesday 19th of August 2015 01:10:42 AM

Need to import customer data with entity ID, too :(. Can someone help me pls :)
 
not published on website


QR Code: Magento:: How to Export Customer ID with Import/Export Profile