2

I am trying to export products with dataflow -Profiles and want to export the field created_at which is in the table catalog_product_entity. The created_at drop down option from field mapping, In database: puts an empty value as the result. Even if there are values in the table.

Would be great if anyone could help me

3

The created_at is a system field, like entity_id and a few others. See app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php, more specifically in the constructor:

public function __construct()
{
    foreach (Mage::getConfig()->getFieldset('catalog_product_dataflow', 'admin') as $code=>$node) {
       // ... output omitted
        if ($node->is('internal')) {
            $this->_internalFields[] = $code;
        }
        if ($node->is('system')) {
            $this->_systemFields[] = $code;
        }
        // ... output omitted
    }
}

and in the unparse() method:

public function unparse()
{
    // ... output omitted
    foreach ($product->getData() as $field => $value) {
        if (in_array($field, $this->_systemFields) || is_object($value)) {
            continue;
        }
    // ... output omitted

Now, you have several options to export the created_at field, all of them requiring custom code:

  1. In your module's config.xml file overwrite the /config/admin/fieldsets/catalog_product_dataflow/created_at/system path and set the value to 0; possibly the easiest solution here
<?xml version="1.0" encoding="utf-8">
<config>
    <!-- module stuff here -->
    <admin>
        <fieldsets>
            <catalog_product_dataflow>
                <created_at>
                    <system>0</system>
                </created_at>
            </catalog_product_dataflow>
        </fieldsets>
    </admin>
</config>
  1. In your module create a new product parser, possibly extending Mage_Catalog_Model_Convert_Parser_Product but overwriting the unparse method; good if you might want some other logic for the export
  2. In your module overwrite the catalog/convert_parser_product model and change the logic of the unparse method; this is just to list it as an option but option #2 is better.
| improve this answer | |
  • wow thanks Adi for the help was really stuck I used option 1 and it worked I am just trying to understand what does setting the value to 0 do that makes it display that field? – Yehuda Schwartz Sep 17 '15 at 17:19
  • 1
    Well, Magento doesn't allow exporting system attributes and created_at was a system attribute. Setting that value to 0 basically tells Magento that the attribute is not a system attribute, so the data flow can export it. – Adi Sep 17 '15 at 17:21

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