We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    If you want to implement “add select all button in Export Product” functionality in Magento 2, then please follow the below step.

    Step 1. Create Magemonkey/Exportproduct/registration.php file and add below code

    <?php
    MagentoFrameworkComponentComponentRegistrar::register(
        MagentoFrameworkComponentComponentRegistrar::MODULE,
        'Magemonkey_Exportproduct',
        __DIR__
    );

    Step 2. Create file of Magemonkey/Exportproduct/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="Magemonkey_Exportproduct" setup_version="1.0.0">
            <sequence>
                <module name="Magento_Backend"/>
            </sequence>
        </module>
    </config>

    Step 3. Create file of Magemonkey/Exportproduct/etc/adminhtml/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="MagentoBackendBlockWidgetGridExtended">
            <plugin disabled="false" name="Magemonkey_Exportproduct_Plugin_Backend_Magento_Backend_Block_Widget_Grid_Extended" sortOrder="10" type="MagemonkeyExportproductPluginBackendMagentoBackendBlockWidgetGridExtended"/>
        </type>
    </config>
    

    Step 4. Create plugin file of Magemonkey/Exportproduct/Plugin/Backend/Magento/Backend/Block/Widget/Grid/Extended.php

    <?php
    namespace MagemonkeyExportproductPluginBackendMagentoBackendBlockWidgetGrid;
    class Extended
    {
        protected $request;
    
    	public function __construct(
            MagentoFrameworkAppRequestHttp $request
        ){
            $this->request = $request;
        }
        public function afterGetMainButtonsHtml(
            MagentoBackendBlockWidgetGridExtended $subject,
            $result
        ) {
        	$moduleName = $this->request->getModuleName();
            $controller = $this->request->getControllerName();
            $action     = $this->request->getActionName();
            $route      = $this->request->getRouteName();
    
            if($controller == 'export' && $action == 'getFilter'){ //check controller and action
            $result .= '<button id="" title="Select All" type="button" class="action-default scalable action-reset action-tertiary" onclick="export_filter_gridJsObject.selectAll()" data-action="grid-filter-reset" data-ui-id="widget-button-3"><span>Select All</span></button>';
        	}else{
        	$result .= '';
        	}
            return $result;
        }
    }
    

    Step 5. Override the /vendor/magento/module-import-export/view/adminhtml/templates/export/form/filter/after.phtml file and add below code after line 18

    export_filter_gridJsObject.selectAll = function () {
                // class admin__control-checkbox is selector 
                var inputs = document.getElementsByClassName("admin__control-checkbox");
                for(var i = 0; i < inputs.length; i++) {
                    if(inputs[i].type == "checkbox") {
                        inputs[i].checked = true;
                    }
                }
            };

     

    Note. Create the admin theme using this link and follow that step https://magemonkeys.com/magento-2-change-default-logo-of-admin-panel

    field_5bfb909c5ccae

      Get a Free Quote