1

I'm trying to override this file:

/vendor/magento/module-import-export/view/adminhtml/templates/export/form/filter/after.phtml

This template file has been declared in:

/vendor/magento/module-import-export/view/adminhtml/layout/adminhtml_export_getfilter.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <container name="root" label="Root">
        <block class="Magento\ImportExport\Block\Adminhtml\Export\Filter" name="export.filter"/>
        <block class="Magento\Backend\Block\Template" template="Magento_ImportExport::export/form/filter/after.phtml" name="export.form.after" as="form_after"/>
    </container>
</layout>

In my custom extension I created a new layout file:

/app/code/[Vendorname]/[Extensionname]/view/adminhtml/layout/adminhtml_export_getfilter.xml

With the following content:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="form_after">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">[Vendorname]_[Extensionname]::export/form/filter/aftertwo.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

I have created my template file for a testing purpose:

/app/code/[Vendorname]/[Extensionname]/view/adminhtml/template/export/form/filter/aftertwo.phtml

I have searched before asking the question, but without success to override the template file after.phtml with aftertwo.phtml. In fact from admin panel it shows the previous template file not mine.

Thank you in advance ^^

0

You have to keep below xml,

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="export.form.after">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">[Vendorname]_[Extensionname]::export/form/filter/aftertwo.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>
  • I tried your solution before but it didn't work too. If I used [Vendorname]_[Extensionname]::export/form/filter/aftertwo.phtml, my template file would be in /app/code/[Vendorname]/[Extensionname]/view/adminhtml/template/export/form/filter/aftertwo.phtml. But I think it should also work with Magento_ImportExport::export/form/filter/aftertwo.phtml if my template file is located at /vendor/magento/module-import-export/view/adminhtml/templates/export/form/filter/aftertwo.phtml. I will update my question with your solution so others could understand. – Abdelkebir ELHARFALI Mar 3 '17 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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