I Loaded a model called fabric_news using this code,
Mage::getModel('fabric_news/news')->getCollection();
But magento tries to load module from wrong name space. So It throws errors Like
Warning: include(Mage/Magentostudy/News/Model/News.php): failed to open stream: No such file or directory in /var/www/test/magento_custom/lib/Varien/Autoload.php on line 94
Kindly help me to overcome this issue.
Another one thing When I call Mage::getModel('fabric_news/news')->getCollection(); function in fabric_news module it is working well. but in fabric_tool module, It is not.
fabric_news config.xml.
<?xml version="1.0"?>
<!--
/**
* Module configuration
*
* @author Fabric
*/
-->
<config>
<modules>
<Fabric_News>
<version>1.0.0.0.1</version>
</Fabric_News>
</modules>
<global>
<models>
<fabric_news>
<class>Fabric_News_Model</class>
<resourceModel>news_resource</resourceModel>
</fabric_news>
<news_resource>
<class>Fabric_News_Model_Resource</class>
<entities>
<news>
<table>fabric_news</table>
</news>
</entities>
</news_resource>
</models>
<helpers>
<fabric_news>
<class>Fabric_News_Helper</class>
</fabric_news>
</helpers>
<blocks>
<fabric_news>
<class>Fabric_News_Block</class>
</fabric_news>
</blocks>
<resources>
<fabric_news_setup>
<setup>
<module>Fabric_News</module>
<class>Mage_Core_Model_Resource_Setup</class>
</setup>
</fabric_news_setup>
</resources>
<events>
<before_news_item_display>
<observers>
<fabric_news>
<class>fabric_news/observer</class>
<method>beforeNewsDisplayed</method>
</fabric_news>
</observers>
</before_news_item_display>
</events>
</global>
<frontend>
<routers>
<fabric_news>
<use>standard</use>
<args>
<module>Fabric_News</module>
<frontName>news</frontName>
</args>
</fabric_news>
</routers>
<layout>
<updates>
<fabric_news>
<file>fabric_news.xml</file>
</fabric_news>
</updates>
</layout>
</frontend>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Fabric_News before="Mage_Adminhtml">Fabric_News_Adminhtml</Fabric_News>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<fabric_news>
<file>fabric_news.xml</file>
</fabric_news>
</updates>
</layout>
</adminhtml>
<default>
<news>
<view>
<enabled>1</enabled>
<items_per_page>20</items_per_page>
<days_difference>3</days_difference>
</view>
</news>
</default>
</config>
1 Answer 1
Perform a case insensitive search of your entire module for the string magentostudy. Best guess is that in app/code/{codePool}/Fabric/News/Resource/News.php you'll have something like:
protected function _construct()
{
$this->_init('magentostudy_news/news', 'entity_id');
}
-
No, It has correct code like $this->_init('fabric_news/news','news_id');Vivek Aasaithambi– Vivek Aasaithambi2015年03月05日 12:03:59 +00:00Commented Mar 5, 2015 at 12:03
-
...and did you search for the string
magentostudyin your entire project?Peter O'Callaghan– Peter O'Callaghan2015年03月05日 12:06:25 +00:00Commented Mar 5, 2015 at 12:06 -
Hi, Thanks for trying to help me. The problem was with my editor. I searched so many times, But found no result. After you said, I changed my editor and searched magentostudy. And found and fixed. Now It is working well. @CagsVivek Aasaithambi– Vivek Aasaithambi2015年03月05日 13:08:20 +00:00Commented Mar 5, 2015 at 13:08
Explore related questions
See similar questions with these tags.
mage_if if can't find the class name.