Develop admin module magento tutorial

This tutorial explains how to develop admin module magento. Here I am showing how to create a basic admin module in magento. The module allow the user to add their social media links in the magento admin area.It also create a textarea for adding the contact information.

Instead of adding static block for displaying the social media links this module automatically display social links as block.

The two main stages are :

  1. Part 1 – Develop admin section
  2. Part 2 – Display frontend layout

Develop admin module

This section it creates the admin area for controlling the module.In the admin area this module add a tab in the magento admin under system->configuration as shown below.The custom text fields allow to enter the additional information and social media links.

develop-admin-module-magento

File Structure

The following files are required to create this module.

develop-admin-module-magento-file-structure

Step by step explanation

  1. Enable magento module
  2. Allow admin access
  3. Create config.xml
  4. Add custom fields magento admin

Enable magento module

For enabling the module create file etc\modules\Addpeople_slinks.xml and enter the following code.

<?xml version="1.0"?>
<config>
    <modules>
        <Addpeople_slinks>
            <active>true</active>
            <codePool>local</codePool>
        </Addpeople_slinks>
    </modules>
</config>

Allow admin access

This section decides who can access the module. In this example the admin permissions are set to all which means all logged in users can access the module.

<?xml version="1.0"?>
<adminhtml>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <addpeople_tab>
                                        <title>Addpeople Slinks</title>
                                    </addpeople_tab>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</adminhtml>

Create config.xml file

<?xml version="1.0"?>
<config>
    <modules>
        <Addpeople_slinks>
            <version>0.1.0</version>
        </Addpeople_slinks>
    </modules>
    <global>
        <helpers>
            <addpeople_slinks>
                <class>Addpeople_slinks_Helper</class>
            </addpeople_slinks>
        </helpers>
    </global>
</config>

Add custom fields magento admin

The magento module development custom fields are declared in the system.xml file. The following code adds the contact details tab in the System->Configuration section magento admin area.Inside the tab I have added the custom fields for enter the social media links as show below.

develop-admin-magento-module-custom-fields
magento-admin-module-development

Please click here to get the full code.

The second part explains how to display the social icons in the frontend.

Share this Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

*