Web Analytics

Fill the form & Get Installation Support

Magento 2 add button in configuration setting with controller action

In Magento there are so many default field types available for configuration settings field, but no type is provided for the button,

To add button in configuration setting, we have to process via custom frontend model.

First we have to put button setting in existing module system.xml or create new module by adding the below code:

[Vendor Name]\[Module Name]\etc\adminhtml\system.xml

Then you have to create frontend model file & add the below code:

[Vendor Name]\[Module Name]\Block\System\Config\Exportproduct.php

Now you have to create button related template file & add the below code:

[Vendor Name]\[Module Name]\view\adminhtml\templates\system\config\exportproduct.phtml

In the end, you have to create your controller action file with your logic & return Json response as per your requirement.

After doing all the above steps run php bin/magento cache:flush command and verify that whether your admin configuration settings display button in your section as shown below or not.

 

Fill the below form if you have any Magento programming need.





    Recent Articles

    Author Info

    Author Image

    Magento Developer

    Hire S. Gorjia

    Get a Free Quote





      /* second popup */

      Connect With Us