1

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>
asked Mar 5, 2015 at 8:29
7
  • What s the wrong module name? Commented Mar 5, 2015 at 9:52
  • magento loads correct module.. but It does not load correct name space. Commented Mar 5, 2015 at 9:55
  • 2
    What does your config.xml look like. Magento attempts to prefix a name space with mage_ if if can't find the class name. Commented Mar 5, 2015 at 10:21
  • Paste your config.xml here. Commented Mar 5, 2015 at 10:23
  • Have updated my question Commented Mar 5, 2015 at 11:17

1 Answer 1

3

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');
}
answered Mar 5, 2015 at 11:45
3
  • No, It has correct code like $this->_init('fabric_news/news','news_id'); Commented Mar 5, 2015 at 12:03
  • ...and did you search for the string magentostudy in your entire project? Commented 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. @Cags Commented Mar 5, 2015 at 13:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.