Add A Button In System Configuration

Adding custom configuration in system configuration is a quite common task when creating a custom module. But what if you want to add a button with some functionality related to your module in system configuration? Lets see how you can add a button and perform an action.

First of all we will need to add our system configuration file, where we will declare our button. What we need for the button is to declare a field with type button and a frontend model as you can see below.

In the frontend model class we have to declare the template file for the button and some functions what we will need, like the ajax url button's action.

In the template file except the html code we have added the javascript code for the button click action, which will be an ajax call to our controller.

As you can see below our controller is really simple and the call just returns a success message. There you can add your custom functionality.

The full example as extension can be found here.

Feel free to share this post and ask your questions in the comments below.

Till next time!