Create magento admin grid tutorial

This tutorial explains how to create magento admin grid. In the previous tutorial explains how to save the data from the contact form to the custom table.

Here it shows how to display saved data from the magento custom table in admin grid as shown below.Click here to download the full code.


Step by step explanation

  1. File structure
  2. Enable magento module
  3. Add admin menu
  4. Create controller
  5. Setup our custom model, resource and collection
  6. Block – Code up magento admin grid
  7. Config xml file

Admin grid file structure

Create the following files.


Enable grid module

As the first step we need enable the magento module.

Add custom admin menu magento

This step add the custom admin menu in the magento admin area as shown below. For creating the admin menu click here and add code in the adminhtml xml file and config xml file.


Setup our custom model, resource and collection

We need to retrieve the data from the custom table for displaying data in the magento admin grid. For that we need to create a custom model.Please click here to find the code for custom model development.

Block – Code up magento admin grid

Click here to refer the section that shows how to create magento admin grid layout. In the _prepareColumns() function declares the grid layout headings.

Create admin controller

The admin controller initiates the gridaction() function. Click here for controller functions.

Magento admin grid config

In the previous steps created the controller, block and model files . This stage we need to include all the files in the config.xml file.Click here find the code for config.xml file.

Click here to download the full code.

Share this Tutorial

Leave a Reply

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