1

Can anyone please tell me How to Create New Magento Dataflow advanced profiles during extension installation in Magento 1.9.x?

3
  • Can anyone please help me on this? Sep 27, 2016 at 5:58
  • Not 100% sure what you mean. Are you looking to create a module that as part of it's set-up scripts will create dataflow profile? Sep 29, 2016 at 7:46
  • @david, Yes I am trying to do that. Sep 29, 2016 at 9:10

1 Answer 1

3

This can be done using a data installer. To learn more about the basics of those please check out this Inchoo Article.

Now for the business end of the data installer; we create a new file in the module root data/my_module/install-1.0.0.php

and create a Dataflow Profile for installation

<?php

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer->startSetup();

/**
 * Dataflow profile data
 */
Mage::getModel('dataflow/profile')->setData([
    'name'         => 'Import OrderAdd items',
    'actions_xml'  => '<action type="dataflow/convert_adapter_io" method="load">
    <var name="type">file</var>
    <var name="path">var/import</var>
    <var name="filename"><![CDATA[csvfile.csv]]></var>
    <var name="format"><![CDATA[csv]]></var>
</action>
<action type="dataflow/convert_parser_csv" method="parse">
    <var name="delimiter"><![CDATA[,]]></var>
    <var name="enclose"><![CDATA["]]></var>
    <var name="fieldnames">true</var>
    <var name="store"><![CDATA[0]]></var>
    <var name="number_of_records">1</var>
    <var name="decimal_separator"><![CDATA[.]]></var>
    <var name="adapter">my_module/dataflow_adapters_import</var>
    <var name="method">saveRow</var>
</action>',
    'gui_data'     => '',
    'direction'    => 'import',
    'entity_type'  => '',
    'store_id'     => 0,
    'data_transfer'=> 'file'
])->save();

$installer->endSetup();

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.