0

I have created a custom module which will save some data in the database and will show in the front end.
But when I see in the front end it gets me a 404 not found error.
I think the error is in the config xml file .
could anyone suggest what are the steps to follow if I get this type of issue ?
This is my config file..

<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
    <Magentostudy_News>
        <version>1.0.0.0.1</version>
    </Magentostudy_News>
</modules>
<global>
    <models>
        <magentostudy_news>
            <class>Magentostudy_News_Model</class>
            <resourceModel>news_resource</resourceModel>
        </magentostudy_news>
        <news_resource>
            <class>Magentostudy_News_Model_Resource</class>
            <entities>
                <news>
                    <table>magentostudy_news</table>
                </news>
            </entities>
        </news_resource>
    </models>
    <helpers>
        <magentostudy_news>
            <class>Magentostudy_News_Helper</class>
        </magentostudy_news>
    </helpers>
    <blocks>
        <magentostudy_news>
            <class>Magentostudy_News_Block</class>
        </magentostudy_news>
    </blocks>
    <resources>
        <magentostudy_news_setup>
            <setup>
                <module>Magentostudy_News</module>
                <class>Mage_Core_Model_Resource_Setup</class>
            </setup>
        </magentostudy_news_setup>
    </resources>
    <events>
        <before_news_item_diplay>
            <observers>
                <magentostudy_news>
                    <class>Magentostudy_News/observer</class>
                    <method>beforeNewsDisplayed</method>
                </magentostudy_news>
            </observers>
        </before_news_item_diplay>
    </events>
</global>
<frontend>
    <routers>
        <magentostudy_news>
            <use>standard</use>
            <args>
                <modules>Magentostudy_News</modules>
                <frontName>news</frontName>
            </args>
        </magentostudy_news>
    </routers>
    <layout>
        <updates>
            <magentostudy_news>
                <file>magentostudy_news.xml</file>
            </magentostudy_news>
        </updates>
    </layout>
</frontend>
<Admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Magentostudy_News before="Mage_adminhtml">Magentostudy_News_adminhtml</Magentostudy_News>
                </modules>
            </args>
        </adminhtml>
    </routers>
</Admin>
<adminhtml>
    <layout>
        <updates>
            <magentostudy_news>
                <file>magentostudy_news.xml</file>
            </magentostudy_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>

Thank you.

2
  • show your code..... Feb 23, 2016 at 11:08
  • @PradeepSanku, I have added the config file. Please have a look. Feb 23, 2016 at 11:24

2 Answers 2

1

You can debug why your module controller is not used here

app/code/core/Mage/Core/Controller/Varien/Router/Standard.php in the method match()

this is where magento tries to find the controller/action for current request. I suggest you use xdebug to debug this

inside this foreach loop

$found = false;
foreach ($modules as $realModule) {

you will see this line

$controllerClassName = $this->_validateControllerClassName($realModule, $controller);

This is where magento tries searches for your controller. In the method _validateControllerClassName() it will generate a class name and file path that it expects from your controller.

0

I found what was wrong in the config.xml.
The <modules> tag under <router> should be <module>.
So the code should be like..

<routers>
    <magentostudy_news>
        <use>standard</use>
        <args>
            <module>Magentostudy_News</module>
            <frontName>news</frontName>
        </args>
    </magentostudy_news>
</routers>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.