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.
- 
 Even try to refer bubblecode.net/en/2012/02/08/…, inchoo.net/magento/how-to-create-a-custom-grid-from-scratchArjun– Arjun2016年07月28日 11:00:44 +00:00Commented Jul 28, 2016 at 11:00
 
3 Answers 3
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>
 - 
 Still "The page not found " html page is showing, i had flushed the cache, logged out & loggedin again !!Shan– Shan2016年07月28日 11:28:19 +00:00Commented Jul 28, 2016 at 11:28
 - 
 thanks buddy!! its working !! adminhtml folder was lowercase(adminhtml)Shan– Shan2016年07月28日 11:33:57 +00:00Commented Jul 28, 2016 at 11:33
 
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.
- 
 I tried this, but not working !!Shan– Shan2016年07月28日 11:03:34 +00:00Commented Jul 28, 2016 at 11:03
 - 
 Please check edited answer.Mohit Kumar Arora– Mohit Kumar Arora2016年07月28日 11:05:31 +00:00Commented Jul 28, 2016 at 11:05
 
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();
 }
}