3

I am trying to export customers and want to export also the field updated_at which is in the table customer_adress_entity.

As in the advanced profile dataflow export there is no choice to choose that field I tried it with the xml actions possibility.

I added the following line

    <map name="updated_at"><![CDATA[updated_at]]></map>

but an empty value is the result. Even if there are values in the table.

1

2 Answers 2

1

So from what I can see the customer dataflow will not export system fields. If you look into the class app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php you can see the function unparse. This converts the data into the csv rows.

At the very beginning of this method it loads all the system fields as defined in the xml app/code/core/Mage/Customer/etc/config.xml see node admin->fieldsets->customer_dataflow.

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

Then during the parsing process the system will look through the customer data and process the data that it would like to export. The problem is that it will skip all data fields flagged as system.

if (in_array($field, $systemFields) || is_object($value)) {
    continue;
}

So you could do one of the following options:

  1. Update the xml nodes so that updated_at is not a system field,
  2. Update the unparse so that you can select some system fields to export,
-2

You need to alter the function load in

app/code/code/Mage/Customer/Model/Convert/Adapter/Customer.php

add below line after this $attrFilterArray ['created_at'] = 'datetimeFromTo'; line

    $attrFilterArray ['updated_at']                 = 'datetimeFromTo';

And then add these :

    /*
     * Fixing date filter from and to
     */
    if ($var = $this->getVar('filter/updated_at/from')) {
        $this->setVar('filter/updated_at/from', $var . ' 00:00:00');
    }

    if ($var = $this->getVar('filter/updated_at/to')) {
        $this->setVar('filter/updated_at/to', $var . ' 23:59:59');
    }

So Basically just copy the created_at related code and change the created_at s to updated_at.

Then you can use that attribute to prepare your filter in Advanced Export profiles.

Cheers

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.