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
1 2 3 4 5 6 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Magemonkey_Exportproduct', __DIR__ ); |
Step 2. Create file of Magemonkey/Exportproduct/etc/module.xml
1 2 3 4 5 6 7 8 |
<?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
1 2 3 4 5 6 |
<?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="Magento\Backend\Block\Widget\Grid\Extended"> <plugin disabled="false" name="Magemonkey_Exportproduct_Plugin_Backend_Magento_Backend_Block_Widget_Grid_Extended" sortOrder="10" type="Magemonkey\Exportproduct\Plugin\Backend\Magento\Backend\Block\Widget\Grid\Extended"/> </type> </config> |
Step 4. Create plugin file of Magemonkey/Exportproduct/Plugin/Backend/Magento/Backend/Block/Widget/Grid/Extended.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php namespace Magemonkey\Exportproduct\Plugin\Backend\Magento\Backend\Block\Widget\Grid; class Extended { protected $request; public function __construct( \Magento\Framework\App\Request\Http $request ){ $this->request = $request; } public function afterGetMainButtonsHtml( \Magento\Backend\Block\Widget\Grid\Extended $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
1 2 3 4 5 6 7 8 9 |
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
[crayon-63e09cb11a20e216181820/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.