0

I'm building an Admin module for the first time by following this tutorial

I have created everything & the module is showing in the backend, but when I clicked the submenu of my module, instead of showing the controller content, what i can see is the "page not found" html page !!

The config details :

<config>
<modules>
  <Pgs_AramexSync>
    <version>1.1.0</version>
  </Pgs_AramexSync>
</modules>
<global>
  <models>
    <aramexSync>
        <class>Pgs_AramexSync_Model</class>
    </aramexSync>
  </models>
<helpers>
    <aramexHelper>
        <class>Pgs_AramexSync_Helper</class>
    </aramexHelper>
</helpers>
 <events>
      <catalog_product_save_after>
        <observers>
            <aramexSync>
                <class>aramexSync/observer</class>
                <method>productUpdate</method>
            </aramexSync>
        </observers>
    </catalog_product_save_after>
</events>
</global>
<admin>
<routers>
    <aramexHelper>
        <use>admin</use>
        <args>
            <module>Pgs_AramexSync</module>
            <frontname>aramexsync</frontname>
        </args>
    </aramexHelper>
</routers>
</admin>
<adminhtml>
<menu>
    <menu1 translate="title">
     <title>Aramex Warehouse Sync</title>
        <sort_order>90</sort_order>
            <children>
                <menuitem_1>
                    <title>Prepare Shipments</title>
                    <action>adminhtml/aramexsync/warehouse</action>
                </menuitem_1>
            </children>                
    </menu1>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <menu1 translate="title">
                    <title>Aramex Warehouse sync</title>
                    <sort_order>90</sort_order>
                    <children>
                        <menuitem_1>
                            <title>Prepare Aramex Warehouse Shipment</title>
                        </menuitem_1>
                    </children>
               </menu1>
           </children>
       </admin>
    </resources>
 </acl>
<acl>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <aramexSync_options>
                                    <title>Pgs Aramex Sync Settings</title>
                                </aramexSync_options>
                            </children>
                        </config>
                    </children>
                </system>
            </children>
        </admin>
    </resources>
</acl>

The controller : App->local->Pgs->AramexSync->controllers

<?php

     class Pgs_AramexSync_WarehouseController extends Mage_Adminhtml_Controller_Action{
    public function indexAction() {
        $this->loadLayout();
        $this->_addContent($this->getLayout()->createBlock('core/template'));
        echo "Hello World";
        $this->renderLayout();
    }   
}

I am working in Magento 1.9, I can't figure out what is wrong with the code.

1
0

Change below code of config.xml :

<admin>
<routers>
    <aramexHelper>
        <use>admin</use>
        <args>
            <module>Pgs_AramexSync</module>
            <frontname>aramexsync</frontname>
        </args>
    </aramexHelper>
</routers>
</admin>

to:

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <aramexHelper after="Mage_Adminhtml">Pgs_AramexSync_Adminhtml</aramexHelper>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

Add controller to

<?php

     class Pgs_AramexSync_Adminhtml_WarehouseController extends Mage_Adminhtml_Controller_Action{
    public function indexAction() {
        $this->loadLayout();
        $this->_addContent($this->getLayout()->createBlock('core/template'));
        echo "Hello World";
        $this->renderLayout();
    }   
}

Change link :

<action>adminhtml/aramexsync/warehouse</action>

to:

<action>adminhtml/warehouse/index</action>
2
  • Still "The page not found " html page is showing, i had flushed the cache, logged out & loggedin again !!
    – Shan
    Jul 28 '16 at 11:28
  • thanks buddy!! its working !! adminhtml folder was lowercase(adminhtml)
    – Shan
    Jul 28 '16 at 11:33
0

Controller file should be placed in adminhtml folder, since the URL you are redirecting from menu is using admin router path.

Second thing, <action>adminhtml/aramexsync/warehouse</action> should be <action>adminhtml/aramexhelper/warehouse</action>.

Third thing, from menu you are redirecting to warehouse action, but in controller there is no action like warehouse.

2
  • I tried this, but not working !!
    – Shan
    Jul 28 '16 at 11:03
  • Please check edited answer. Jul 28 '16 at 11:05
0

Add bellow code in config.xml

<?xml version="1.0"?>
<config>
<modules>
  <Pgs_AramexSync>
    <version>1.1.0</version>
  </Pgs_AramexSync>
</modules>
<admin>
    <routers>
        <aramexsync>
            <use>admin</use>
            <args>
                <module>Pgs_AramexSync</module>
                <frontName>aramexsync</frontName>
            </args>
        </aramexsync>
    </routers>
</admin>   
<global>
  <models>
    <aramexSync>
        <class>Pgs_AramexSync_Model</class>
    </aramexSync>
  </models>
<helpers>
    <aramexHelper>
        <class>Pgs_AramexSync_Helper</class>
    </aramexHelper>
</helpers>
 <events>
      <catalog_product_save_after>
        <observers>
            <aramexSync>
                <class>aramexSync/observer</class>
                <method>productUpdate</method>
            </aramexSync>
        </observers>
    </catalog_product_save_after>
</events>
</global>
<adminhtml>
<menu>
    <menu1 translate="title">
     <title>Aramex Warehouse Sync</title>
        <sort_order>90</sort_order>
            <children>
                <menuitem_1>
                    <title>Prepare Shipments</title>
                    <action>aramexsync/adminhtml_warehouse/</action> 
                </menuitem_1>
            </children>                
    </menu1>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <menu1 translate="title">
                    <title>Aramex Warehouse sync</title>
                    <sort_order>90</sort_order>
                    <children>
                        <menuitem_1>
                            <title>Prepare Aramex Warehouse Shipment</title>
                        </menuitem_1>
                    </children>
               </menu1>
           </children>
       </admin>
    </resources>
 </acl>
<acl>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <aramexSync_options>
                                    <title>Pgs Aramex Sync Settings</title>
                                </aramexSync_options>
                            </children>
                        </config>
                    </children>
                </system>
            </children>
        </admin>
    </resources>
</acl>
</adminhtml>
</config>

Create controller file WarehouseController.php at location app\code\local\Pgs\AramexSync\controllers\Adminhtml

and add bellow code in controller file

<?php
class Pgs_AramexSync_Adminhtml_WarehouseController extends Mage_Adminhtml_Controller_Action
{

    public function indexAction()
    {
        $this->loadLayout();
        echo "Hello World";
        $this->renderLayout();
    }
}

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.