|
Hi, everyone. Absolutely, I am newer for magento ce . I followed this great tutorial http://alanstorm.com/magento_models_orm . But I got stuck by now.
I am using magento 1.7.0.2 and below is my copy code.
My question is : How to get data from the model based on the config.xml which in the attachment ?
My module’s model directory is:
app/local/Alanstormdotcom/Weblog/Model/Blogpost.php
<?php class Alanstormdotcom_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract { protected function _construct() { $this->_init('weblog/blogpost'); } }
app/local/Alanstormdotcom/Weblog/Model/Mysql4/Blogpost.php
<?php class Alanstormdotcom_Weblog_Model_Mysql4_Blogpost extends Mage_Core_Model_Mysql4_Abstract{ protected function _construct() { $this->_init('weblog/blogpost', 'blogpost_id'); } }
and my controllers is:
app/local/Alanstormdotcom/Weblog/controllers/IndexController.php
<?php class Alanstormdotcom_Weblog_IndexController extends Mage_Core_Controller_Front_Action { public function testModelAction() { $params = $this->getRequest()->getParams(); echo("Loading the blogpost with an ID of ".$params['id']); $blogpost = Mage::getModel('weblog/blogpost'); $blogpost->load($params['id']); $data = $blogpost->getData(); var_dump($data); } }
last the error msg is :
Loading the blogpost with an ID of 1
Warning: include(D:\is\xampp\htdocs\magento\includes\src\Alanstormdotcom_Weblog_Model_Blogpost.php): failed to open stream: No such file or directory in D:\is\xampp\htdocs\magento\includes\src\Varien_Autoload.php on line 93
I hope someone can help me with this question. I got head scratch by this.
Image Attachments
Click thumbnail to see full-size image
|