1

I am using magento 1.8. And creating custom admin module called manoreport, In single admin module I have 3 functionality fees, donation, commissionconfig, Seperate controller and block for each functionality. And I am creating custom table for only commissionconfig [table name is commission_config], I am getting this install script in core_resource table, and table commission_table also created when I refresh the page.

Here is the config.xml file code for the new table and resources

 <global>
        <models>
            <manoreport>
                <class>Npm_Manoreport_Model_Commissionconfig</class>
                <resourceModel>manoreport_mysql4</resourceModel>
            </manoreport>
            <manoreport_mysql4>
                <class>Npm_Manoreport_Model_Mysql4_Commissionconfig</class>
                <entities>
                    <commission_config>
                        <table>commission_config</table>
                    </commission_config>
                </entities>
            </manoreport_mysql4>
        </models>
        <resources>
            <commission_config_setup>
                <setup>
                    <module>Npm_Manoreport</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </commission_config_setup>
            <commission_config_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </commission_config_write>
            <commission_config_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </commission_config_read>
        </resources>

But in commissionconfig grid, when I call the function

$collection = Mage::getModel('manoreport/commission_config')->getCollection();

Its blank and I am not getting grid.

In my model folder. I have these files. Npm/Manoreport/Model/Commissionconfig

<?php
class Npm_Manoreport_Model_Commissionconfig extends Mage_Core_Model_Abstract
{
    public function _construct()
    {
        parent::_construct();
        $this->_init('manoreport/commissionconfig');
    }
}

Npm/Manoreport/Model/Mysql4/Commissionconfig

<?php
class Npm_Manoreport_Model_Mysql4_Commissionconfig extends Mage_Core_Model_Mysql4_Abstract
{
    public function _construct()
    {
        $this->_init('manoreport/commissionconfig', 'commissionconfig_id');
    }
}

Npm/Manoreport/Model/Mysql4/Commissionconfig/Collection

<?php
class Npm_Manoreport_Model_Mysql4_Commissionconfig_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
    public function _construct()
    {
        parent::_construct();
        $this->_init('manoreport/commissionconfig');
    }
}

What is my fault? Why I am getting blank page in grid and blank collection.?

1

Charlie here Models in declareation Just change

<entities>
    <commission_config>
    <table>commission_config</table>
    </commission_config>
</entities>

to

  <entities>
        <commissionconfig>
        <table>commission_config</table>
        </commissionconfig>
    </entities>

As you have

manoreport/commission_config change manoreport/commissionconfig change

Thus:

$collection = Mage::getModel('manoreport/commissionconfig')->getCollection();
1
  • Tanks a lot. :)
    – Charlie
    Jul 7 '14 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.