1

I have created custom module and model but could not insert the data into database using the model please help how to do it

config.xml


<?xml version="1.0"?>
<config>
    <modules>
        <stallioni_vendorpage>
            <version>0.1.0    
        </stallioni_vendorpage>
    </modules>
    <global>
        <models>
            <stallioni_vendorpage>
                <class>Stallioni_Vendorpage_Model</class>
                <resourceModel>vendorpage_resource</resourceModel>
            </stallioni_vendorpage>
            <vendorpage_resource>
                <class>Stallioni_Vendorpage_Model_Resource</class>
                <entities>
                    <vendorpage>
                        <table>vendorpage</table>
                    </vendorpage>
                </entities>
            </vendorpage_resource>
          </models>
        <resources>
            <vendorpage_setup>
                <setup>
                    <module>Stallioni_Vendorpage</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </vendorpage_setup>
            <vendorpage_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </vendorpage_read>
            <vendorpage_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </vendorpage_write>
        </resources>
        <blocks>
            <vendorpage>
                <class>Stallioni_Vendorpage_Block</class>
            </vendorpage>
        </blocks>
    </global>
    <frontend>
        <routers>
            <vendorpage>
                <use>standard</use>
                <args>
                    <module>stallioni_vendorpage</module>
                    <frontName>vendorpage</frontName>
                </args>
            </vendorpage>
        </routers>
        <layout>
                <updates>
                    <vendorpage>
                        <file>vendorpage.xml</file>
                    </vendorpage>
                </updates>
            </layout>
    </frontend>

</config>

model resource code


 class Stallioni_Vendorpage_Model_Resource_Vendorpage extends Mage_Core_Model_Resource_Db_Abstract
{
    protected function _construct()
    {
        $this->_init('vendorpage/vendorpage','vendorpage_id');
        //$this->_blockGroup = 'vendorpage';
    }

}

2

You're missing the closing version tag in your config XML, but that might just be a typo when posting it here.

Your model and resource model namespace should be the same, only the resource model adds _resource to the end.

Currently your model alias is:

<models>
    <stallioni_vendorpage>

You should change it to:

<models>
    <vendorpage>

This way it will match the entity you're registering in your resource model.

| improve this answer | |

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.