3
votes

I read and following this guide

But this error :

Fatal error: Call to a member function load() on a non-object in C:\wamp\www\Ishop\app\code\core\Mage\Core\Model\Abstract.php on line 225

this is config.xml

<models>
        <weblog>
            <class>Magentotutorial_Weblog_Model</class>
            <resourceModel>weblog_resource</resourceModel>
        </weblog>
         <weblog_resource>
            <class>Magentotutorial_Weblog_Model_Resource</class>
            <entities>
                <blogpost>
                    <table>blog_posts</table>
                </blogpost>
            </entities>
        </weblog_resource>
  </models>

I added table with name is blog_posts. I am a newbie with Magento. Is the way to debug this issue? I think error in config.xml file. but I review it several times, still don't find error.

1
Are you able to load the blog post by passing ID ?Slimshadddyyy
Put all model files in here also config.xmlAmit Bera

1 Answers

2
votes

It seems like there's a problem within one of your models.

You should have a file app/code/local/Magentotutorial/Weblog/Model/Blogpost.php:

<?php
    class Magentotutorial_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract
    {
        protected function _construct()
        {
            $this->_init('weblog/blogpost');
        }
    }
?>

And a file app/code/local/Magentotutorial/Weblog/Model/Resource/Blogpost.php:

<?php
    class Magentotutorial_Weblog_Model_Resource_Blogpost extends Mage_Core_Model_Resource_Db_Abstract{
        protected function _construct()
        {
            $this->_init('weblog/blogpost', 'blogpost_id');
        }
    } 
?>

And a file app/code/local/Magentotutorial/Weblog/Model/Resource/Blogpost/Collection.php:

<?php
    class Magentotutorial_Weblog_Model_Resource_Blogpost_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
        protected function _construct()
        {
                $this->_init('weblog/blogpost');
        }
    }
?>