Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento Model is not Working
    primarykey
    data
    text
    <p>I am following this tutorial <a href="http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics" rel="nofollow">http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics</a>.</p> <p>As per this tutorial,when i pass a value with url like(http://localhost/dev/weblog/index/testModel/id/1), I am getting error like this </p> <pre><code>Fatal error: Call to a member function load() on a non-object in app\code\local\Srivats\Weblog\controllers\IndexController.php on line 10 </code></pre> <p>This is my index controller code</p> <pre><code>&lt;?php class Srivats_Weblog_IndexController extends Mage_Core_Controller_Front_Action { public function testModelAction() { $params = $this-&gt;getRequest()-&gt;getParams(); $blogpost = Mage::getModel('weblog/blogpost'); echo("Loading the blogpost with an ID of ".$params['id']); $blogpost-&gt;load($params['id']); $data = $blogpost-&gt;getData(); var_dump($data); } } </code></pre> <p>Blogpost.php file</p> <pre><code>&lt;?php class Srivats_Weblog_Model_Mysql4_Blogpost extends Mage_Core_Model_Mysql4_Abstract { protected function _construct() { $this-&gt;_init('weblog/blogpost','blogpost_id'); } } </code></pre> <p>Here is my config file</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;config&gt; &lt;global&gt; &lt;modules&gt; &lt;srivats_weblog&gt; &lt;version&gt;1.0.0&lt;/version&gt; &lt;/srivats_weblog&gt; &lt;/modules&gt; &lt;models&gt; &lt;weblog_mysql4&gt; &lt;class&gt;Srivats_Weblog_Model_Mysql4&lt;/class&gt; &lt;resourceModel&gt;weblog_mysql4&lt;/resourceModel&gt; &lt;/weblog_mysql4&gt; &lt;/models&gt; &lt;/global&gt; &lt;frontend&gt; &lt;routers&gt; &lt;weblog&gt; &lt;use&gt;standard&lt;/use&gt; &lt;args&gt; &lt;module&gt;Srivats_Weblog&lt;/module&gt; &lt;frontName&gt;weblog&lt;/frontName&gt; &lt;/args&gt; &lt;/weblog&gt; &lt;/routers&gt; &lt;/frontend&gt; &lt;/config&gt; </code></pre> <p>system.log shows </p> <blockquote> <p>Warning: include() [function.include]: Failed opening 'Mage\Weblog\Model\Blogpost.php' for inclusion (include_path='app\code\local;E:\dev\app\code\community;app\code\core;E:\dev\lib;.;C:\php\pear') in lib\Varien\Autoload.php on line 93</p> </blockquote> <p>Here is the link to all files <a href="https://gist.github.com/cf99e4277599954f38d4" rel="nofollow">https://gist.github.com/cf99e4277599954f38d4</a> I think this line <code>$blogpost-&gt;load($params['id']);</code> causing trouble.What i am missing.Any pointers?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload