Magento 1 – How to Define Custom Table and Retrieve Data into Grid

collection;databasegridmodule

i'm writing a module to retrieve the data from a table (i manually created it by using phpmyadmin), but i don't know how to access it in grid.php

<?php
class TempName_AdminLog_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
    public function __construct()
    {
        parent::__construct();
        $this->setId('tempname_admninlog_grid');
        $this->setDefaultSort('increment_id');
        $this->setDefaultDir('DESC');
        $this->setSaveParametersInSession(true);
        $this->setUseAjax(true);
    }
    protected function _prepareCollection()
    {
        ***$collection = Mage::getResourceModel('sales/order_collection')***

        return $this;
    }
    protected function _prepareColumns()
    {

    }
    public function getGridUrl()
    {

    }
}

how to access the table "admin_log" in _prepareCollection method? Anyone knows what i actually have to do?

Best Answer

you can learn from this post, they provide a nice tutorial:

http://excellencemagentoblog.com/admin-part1-series-magento-admin-forms-grids-controllers-tabs
http://excellencemagentoblog.com/admin-part2-series-magento-admin-forms-grids-controllers-tabs
http://excellencemagentoblog.com/module-development-series-magento-admin-module-part3
http://excellencemagentoblog.com/magento-admin-form-field
Related Topic