2

An extension I'm using creates two custom pages in website:

app/design/frontend/mytheme/default/layout/scommerce_competition.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <competition_index_index>
        <label>Competition</label>
        <reference name="head">
            <action method="setTitle" translate="title"><title>Competition</title></action>
            <action method="addCss"><stylesheet>css/competition.css</stylesheet></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="scommerce_competition/entry" name="entry" template="scommerce/competition/entry.phtml">
            </block>
        </reference>
    </competition_index_index>

    <competition_index_enter>
        <label>Competition</label>
        <reference name="head">
            <action method="setTitle" translate="title"><title>Competition</title></action>
            <action method="addJs"><script>scommerce/jquery-1.8.3.min.js</script></action>
            <action method="addCss"><stylesheet>css/competition.css</stylesheet></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="scommerce_competition/success" name="success" template="scommerce/competition/success.phtml">
            </block>
        </reference>
    </competition_index_enter>
</layout>

competition_index_index works ok but competition_index_enter page gives 404 not found error.

etc/config.xml

<frontend>
    <routers>
        <competition>
            <use>standard</use>
            <args>
                <module>Scommerce_Competition</module>
                <frontName>competition</frontName>
            </args>
        </competition>
    </routers>
    <layout>
        <updates>
            <competition>
                <file>scommerce_competition.xml</file>
            </competition>
        </updates>
    </layout>
</frontend>

What could cause this error? Any ideas?

2
+50

<competition_index_index> means : <routername_controllername_actionname>

So for <competition_index_index> and <competition_index_enter>, you'll have :

app/code/local/Scommerce/Competition/controllers/IndexController.php

<?php
class Scommerce_Competition_IndexController extends Mage_Core_Controller_Front_Action
{

    /*<competition_index_index>*/

    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

    /*<competition_index_enter>*/

    public function enterAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

}

Clean the Magento and Browser cache and it should work.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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