3

When my structure in this app/code/community/Mage it works, but when this pattern in app/code/community/Mymodule... page returns 404

I do not know what to do so that I can access the page normally

etc/modules/Mymodule_Payment.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mymodule_Payment>
            <active>true</active>
            <codePool>community</codePool>
        </Mymodule_Payment>
    </modules>
</config>

system.xml

<?xml version="1.0"?>
<config>
   <sections>
        <payment>
            <groups>
                <mymodule translate="label" module="paygate">
                    <label>Mymodule</label>
                    <sort_order>670</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>                        
                        <active translate="label">
                            <label>Active</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>01</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>                            
                        </active>
                    </fields>
                </mymodule>
            </groups>
        </payment>
    </sections>
</config>

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mymodule_Payment>
            <version>1.0.0</version>
        </Mymodule_Payment>
    </modules> 
    <global>
        <resources>
              <mymodule_payment_setup>
                    <setup>
                          <module>Mymodule_Payment</module>
                    </setup>
                    <connection>
                          <use>core_setup</use>
                    </connection>
              </mymodule_payment_setup>
              <payment_write>
                <connection>
                  <use>core_write</use>
                </connection>
            </payment_write>
            <payment_read>
               <connection>
                <use>core_read</use>
              </connection>
            </payment_read>
        </resources>
        <blocks>
            <mymodule>
                <class>Mymodule_Payment_Block</class>
            </mymodule>
        </blocks>
        <models>
            <mymodule>
                <class>Mymodule_Payment_Model</class>
            </mymodule>
        </models>        
        <helpers>
            <mymodule>
                <class>Mymodule_Payment_Helper</class>
            </mymodule>
        </helpers>
    </global>
    <adminhtml>
        <translate>
            <modules>
                <Mymodule_Payment>
                    <files>
                        <default>Mymodule_Payment.csv</default>
                    </files>
                </Mymodule_Payment>
            </modules>
        </translate>        
        <layout>
            <updates>
                <mymodule>
                    <file>mymodule.xml</file>
                </mymodule>
            </updates>
        </layout>
    </adminhtml>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <mymodule>
                        <Mymodule_Payment_Adminhtml before="Mage_Adminhtml">Mymodule_Payment_Adminhtml</Mymodule_Payment_Adminhtml>
                    </mymodule>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <frontend>
        <translate>
            <modules>
                <Mymodule_Payment>
                    <files>
                        <default>Mymodule_Payment.csv</default>
                    </files>
                </Mymodule_Payment>
            </modules>
        </translate>
    </frontend>
    <default>
        <payment>
            <mymodule>
                <active>0</active>
            </mymodule>
         </payment>
    </default>  
</config>

adminhtml.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
    <menu>
        <mymodule_menu translate="title" module="mymodule">
        <title>PagSeguro</title>
        <sort_order>1000</sort_order>
            <children>
                <mymodule_conciliation translate="title" module="mymodule">
                    <title>Conciliation</title>
                    <action>mymodule/adminhtml_conciliation</action>
                    <sort_order>2000</sort_order>
                </mymodule_conciliation>
                <mymodule_abandoned translate="title" module="mymodule">
                    <title>Abandoned</title>
                    <action>mymodule/adminhtml_abandoned</action>
                    <sort_order>2100</sort_order>
                </mymodule_abandoned>
                <mymodule_config translate="title" module="mymodule">
                    <title>Configurações</title>
                    <action>adminhtml/system_config/edit/section/payment/</action>
                    <sort_order>2200</sort_order>
                </mymodule_config>
            </children>
        </mymodule_menu>
    </menu> 
    <acl>
        <resources>
            <admin>
                <children>
                    <catalog>
                        <children>
                            <mymodule_adminform>
                                <title>PagSeguro</title>
                            </mymodule_adminform>
                        </children>
                    </catalog>
                </children>
            </admin>
        </resources>
    </acl>
</config>

controller/Adminhtml/ConciliationController.php

class Mymodule_Payment_Adminhtml_ConciliationController extends Mage_Adminhtml_Controller_Action
{   
    public function indexAction()
    {   
        $this->loadLayout();        
        $this->_setActiveMenu('mymodule_menu')->renderLayout();             
    }       
}

controller/Adminhtml/AbandonedController.php

class Mymodule_Payment_Adminhtml_AbandonedController extends Mage_Adminhtml_Controller_Action
{   
    public function indexAction()
    {   
        $this->loadLayout();        
        $this->_setActiveMenu('mymodule_menu')->renderLayout();             
    }       
}
4
  • put config.xml code here?
    – Amit Bera
    Commented Sep 29, 2014 at 16:54
  • removed the menu config.xml and put in adminhtml.xml @AmitBera
    – Dexxtz
    Commented Sep 29, 2014 at 17:01
  • the module complete this in question @AmitBera
    – Dexxtz
    Commented Sep 29, 2014 at 17:42
  • this example also of 404 - magentocommerce.com/wiki/5_-modules_and_development/0-_module_development_in_magento/how_to_create_an_admin_form_module
    – Dexxtz
    Commented Sep 29, 2014 at 18:20

2 Answers 2

4

Issue1: controller file location is wrong

controller/ConciliationController.php

it should be controller s

 ../Mymodule/Payment/controllers/Adminhtml/ConciliationController.php

As you define class Mymodule_Payment_Adminhtml_ConciliationController

Issue2:

<?xml version="1.0" encoding="UTF-8"?>
<config>
   <menu>
        <mymodule_menu translate="title" module="mymodule">
        <title>PagSeguro</title>
        <sort_order>1000</sort_order>
            <children>
                <mymodule_conciliation translate="title" module="mymodule">
                    <title>Conciliation</title>
                    <action>adminhtml/conciliation</action>
                    <sort_order>2000</sort_order>
                </mymodule_conciliation>
                <mymodule_abandoned translate="title" module="mymodule">
                    <title>Abandoned</title>
                    <action>adminhtml/abandoned/index</action>
                    <sort_order>2100</sort_order>
                </mymodule_abandoned>
                <mymodule_config translate="title" module="mymodule">
                    <title>Configurações</title>
                    <action>adminhtml/system_config/edit/section/payment/</action>
                    <sort_order>2200</sort_order>
                </mymodule_config>
            </children>
        </mymodule_menu>
    </menu> 
    <acl>
        <resources>
            <admin>
                <children>
                    <conciliation translate="title" module="mymodule">
                        <title>My Controller</title>
                        <sort_order>-100</sort_order>
                    </conciliation>
                </children>

            </admin>
        </resources>
    </acl>
</config>

Creating a Simple Admin Module - Routing Problem

http://www.solvingmagento.com/magento-routers-a-look-under-the-hood

5
  • structure controller/Adminhtml/ConciliationController.php was already certain, put the router and not resolved, which I find strange that the /Mage works and outside /Mage 404 @AmitBera
    – Dexxtz
    Commented Sep 29, 2014 at 17:19
  • is it full config.xml?
    – Amit Bera
    Commented Sep 29, 2014 at 17:21
  • have you create Mymodule_Payment.xml at app/etc/modules?
    – Amit Bera
    Commented Sep 29, 2014 at 17:23
  • I have, the module works properly when it is not 404 app/code/community/Mage/Payment ... but does not work in app/code/community/Mymodule/Payment @AmitBera
    – Dexxtz
    Commented Sep 29, 2014 at 17:28
  • ok .i will check
    – Amit Bera
    Commented Sep 29, 2014 at 17:29
0

Reply:

<admin>
    <routers>
        <adminhtml>
            <args>
                <mymodule>
                    <Mymodule_Payment_Adminhtml before="Mage_Adminhtml">Mymodule_Payment_Adminhtml</Mymodule_Payment_Adminhtml>
                </mymodule>
            </args>
        </adminhtml>
    </routers>
</admin>

replace it

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <payment before="Mage_Adminhtml">Mymodule_Payment</payment>         
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
1
  • is it resolved.??
    – Amit Bera
    Commented Sep 29, 2014 at 20:24

Your Answer

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

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