How to extend
Order workflow
Add custom export format
- Create an own module:
-
-
As the first step, we need to introduce a custom module
-
See how to create a new Module at the Magento developer documentation
-
- In the following example, we create the module
MyModule_CustomOrderExportFormat
:
mkdir -p app/code/MyModule/CustomOrderExportFormat/etc (1)
touch app/code/MyModule/CustomOrderExportFormat/etc/module.xml (2)
touch app/code/MyModule/CustomOrderExportFormat/registration.php (3)
1 | Create the folder structure MyModule |
2 | Create the required module.xml |
3 | Create the required registration.php |
app/code/MyModule/CustomOrderExportFormat/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MyModule_CustomOrderExportFormat" setup_version="1.0.0">
<sequence>
<module name="TechDivision_PacemakerOrderExport"/>
</sequence>
</module>
</config>
app/code/MyModule/CustomOrderExportFormat/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'MyModule_CustomOrderExportFormat',
__DIR__
);
We need to specify the |
Add custom transport adapter
Add an executor, which transports your transformed order to a target destination in the same way as described for custom export formatter.
- To register your executor, you need to add the following entry to the
di.xml
of your modul:
app/code/MyModule/CustomOrderExportTransportAdapter/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="TechDivision\PacemakerOrderExport\Model\TransportAdapterProvider">
<arguments>
<argument name="transportAdapterList" xsi:type="array">
<item name="my_custom_transport_adapter" xsi:type="array">
<item name="code" xsi:type="string">my_custom_transport_adapter</item>
<item name="label" xsi:type="string">My Custom Transport Adapter</item>
<item name="type" xsi:type="string">MyModule\CustomOrderExportTransportAdapter\Model\MyExecutor</item>
</item>
</argument>
</arguments>
</type>
</config>
Add custom order response handler
Add an executor, which handles the order export response, in the same way as described for custom export formatter.
- To register your executor you need to add following entry to the
di.xml
of your module:
app/code/MyModule/CustomOrderExportResponseHandler/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="TechDivision\PacemakerOrderExport\Model\ResponseHandlerProvider">
<arguments>
<argument name="handlerList" xsi:type="array">
<item name="my_custom_response_handler" xsi:type="array">
<item name="code" xsi:type="string">my_custom_response_handler</item>
<item name="label" xsi:type="string">My Custom Response Handler</item>
<item name="type" xsi:type="string">MyModule\CustomOrderExportResponseHandler\Model\MyExecutor</item>
</item>
</argument>
</arguments>
</type>
</config>
Add custom notification handler
Add an executor, which sends a (or multiple) notification, in the same way as described for custom export formatter.
- To register your executor you need to add following entry to the
di.xml
of your module:
app/code/MyModule/CustomOrderExportNotification/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="TechDivision\PacemakerOrderExport\Model\NotificationHandlerProvider">
<arguments>
<argument name="notificationHandlerList" xsi:type="array">
<item name="my_custom_notification" xsi:type="array">
<item name="code" xsi:type="string">my_custom_notification</item>
<item name="label" xsi:type="string">My Custom Notification</item>
<item name="type" xsi:type="string">MyModule\CustomOrderExportNotification\Model\MyExecutor</item>
</item>
</argument>
</arguments>
</type>
</config>