2
votes

I have created some custom actions to use inside a Magento Dataflow profile. I would like to pass in composite parameter values (arrays or dictionaries) to the action, similar to the map var you can pass to the default parser actions. I.e., I would like to do something like this:

<var name="attribute_map">
    <map name="sColore"><![CDATA[colore]]></map>
    <map name="sMarca"><![CDATA[marca]]></map>
    <map name="sFornitore"><![CDATA[fornitore]]></map>
</var>

The variable turns out as null in this case, although, upon fiddling with the xml and skimming through the code, it seems that this pattern only works with <var name="map">. Puzzling and disappointing. I also have not been able to find even the slightest hint about the relevant xml schema in any documentation whatsoever...

Any idea on this? Thanks!

(I am working with Community Edition version 1.7.0.2)

2

2 Answers

0
votes

If i understand right what you ask, you could overwrite the system/convert/profile/wizard.phtml from admin and add another section similar to existing map but the form elements should have name="gui_data[attribute_map]...[]".

Then you should overwrite the _parseGuiData method from Mage_Dataflow_Model_Profile to form the correct profile actions xml. Hope that helps.

0
votes

You can't, using the core implementation.

The var elements can only contain simple text, unless the element has the attribute name="map", in which case the profile parser will search for children map elements and use them to populate a php associative array.

The relevant code is inside the importProfileXml method of the Mage_Dataflow_Model_Convert_Profile_Collection class:

if ($varNode['name'] == 'map') {
   $mapData = array();
   foreach ($varNode->map as $mapNode) {
      $mapData[(string)$mapNode['name']] = (string)$mapNode;
   }
   $container->setVar((string)$varNode['name'], $mapData);
}

To extend this behavior you should override this class with a custom (sub)class through the usual magento class override methods.