Magento Module Admin returns a 404 -
trust me know there million questions , responses on topic. have custom module backend portion returning 404. have scoured config file doesn't "seem" have errors (obviously there 1 if returns 404). wondering if there eye can find error! if any. module loading (frontend shows up). config file:
<?xml version="1.0"?> <config> <modules> <namespace_testmysql4> <version>0.1.0</version> </namespace_testmysql4> </modules> <frontend> <routers> <testmysql4> <use>standard</use> <args> <module>namespace_testmysql4</module> <frontname>testmysql4</frontname> </args> </testmysql4> </routers> <layout> <updates> <testmysql4> <file>testmysql4.xml</file> </testmysql4> </updates> </layout> </frontend> <!--admin add needed? --> <admin> <routers> <!--<testmysql4> <use>admin</use> <args> <module>namespace_testmysql4</module> <frontname>testmysql4</frontname> </args> </testmysql4> --> <adminhtml> <args> <modules> <testmysql4 before="mage_adminhtml">namespace_testmysql4_adminhtml</testmysql4> </modules> </args> </adminhtml> </routers> </admin> <adminhtml> <menu> <testmysql4 translate ="title" module="testmysql4"> <title>testmysql4</title> <sort_order>71</sort_order> <children> <items translate="title" module="testmysql4"> <title>manage reports</title> <sort_order>0</sort_order> <action>adminhtml/testmysql4</action> </items> </children> </testmysql4> </menu> <acl> <resources> <all> <title>allow everything</title> </all> <admin> <children> <testmysql4> <title>testmysql4 module</title> <sort_order>200</sort_order> </testmysql4> </children> </admin> </resources> </acl> <layout> <updates> <testmysql4> <file>testmysql4.xml</file> </testmysql4> </updates> </layout> </adminhtml> <!-- admin changes --> <global> <models> <testmysql4> <class>namespace_testmysql4_model</class> <resoucemodel>testmysql4_mysql4</resoucemodel> </testmysql4> <testmysql4_mysql4> <class>namespace_testmysql4_model_mysql4</class> <entities> <testmysql4> <table>testmysql4</table> </testmysql4> </entities> </testmysql4_mysql4> </models> <resources> <testmysql4_setup> <setup> <module>namespace_testmysql4</module> </setup> <connection> <use>core_setup</use> </connection> </testmysql4_setup> <testmysql4_write> <connection> <use>core_write</use> </connection> </testmysql4_write> <testmysql4_read> <connection> <use>core_read</use> </connection> </testmysql4_read> </resources> <blocks> <testmysql4> <class>namespace_testmysql4_block</class> </testmysql4> </blocks> <helpers> <testmysql4> <class>namespace_testmysql4_helper</class> </testmysql4> </helpers> </global> </config>
ignore namespace, there actual name there chose leave out privacy issues. appreciate help!! need backend working.
edit:
here's file paths:
[root@x8dy-cvnm testmysql4]# ls -r .: block controllers etc helper model sql ./block: adminhtml ./block/adminhtml: testmysql4 testmysql4.php ./block/adminhtml/testmysql4: edit edit.php grid.php ./block/adminhtml/testmysql4/edit: form.php tab tabs.php ./block/adminhtml/testmysql4/edit/tab: form.php ./controllers: adminhtml indexcontroller.php ./controllers/adminhtml: testmysql4controller.php ./etc: config.xml ./helper: data.php ./model: mysql4 testmysql4.php ./model/mysql4: testmysql4 testmysql4.php ./model/mysql4/testmysql4: collection.php ./sql: testmysql4_setup ./sql/testmysql4_setup: mysql4-install-0.1.0.php
here controller:
<?php class namespace_testmysql4_adminhtml_testmysql4controller extends mage_adminhtml_controller_action { protected function _initaction() { $this->loadlayout()->_setactivemenu('testmysql4/items')->_addbreadcrumb(mage::helper('adminhtml')->__('items manager'), mage::helper('adminhtml')->__('item manager')); return $this; } public function indexaction() { //$this->_initaction(); //$this->_addcontent($this->getlayout()->createblock('testmysql4/adminhtml_testmysql4')); //$this->renderlayout(); echo 'hello'; //my goal see if called function @ (1st) step } public function editaction() { $testmysql4id = $this->getrequest()->getparam('id'); $testmysql4model = mage::getmodel('testmysql4/testmysql4')->load($testmysql4id); if ($testmysql4model->getid() || $testmysql4id == 0) { mage::register('testmysql4_data', $testmysql4model); $this->loadlayout(); $this->_setactivemenu('testmysql4/items'); $this->_addbreadcrumb(mage::helper('adminhtml')->__('item manager'), mage::helper('adminhtml')->__('item manager')); $this->_addbreadcrumb(mage::helper('adminhtml')->__('item news'), mage::helper('adminhtml')->__('item news')); $this->getlayout()->getblock('head')->setcanloadextjs(true); $this->_addcontent($this->getlayout()->createblock('testmysql4/adminhtml_testmysql4_edit')) ->_addleft($this->getlayout()->createblock('testmysql4/adminhtml_testmysql4_edit_tabs')); $this->renderlayout(); } else { mage::getsingleton('adminhtml/session')->adderror(mage::helper('testmysql4')->__('item not exist')); $this->_redirect('*/*/'); } } public function newaction() { $this->_forward('edit'); } public function saveaction() { if ( $this->getrequest()->getpost() ) { try { $postdata = $this->getrequest()->getpost(); $testmysql4model = mage::getmodel('testmysql4/testmysql4'); $testmysql4model->setid($this->getrequest()->getparam('id'))->settitle($postdata['title'])->setcontent($postdata['content'])->setstatus($postdata['status'])->save(); mage::getsingleton('adminhtml/session')->addsuccess(mage::helper('adminhtml')->__('item saved')); mage::getsingleton('adminhtml/session')->settestmysql4data(false); $this->_redirect('*/*/'); return; } catch (exception $e) { mage::getsingleton('adminhtml/session')->adderror($e->getmessage()); mage::getsingleton('adminhtml/session')->settestmysql4data($this->getrequest()->getpost()); $this->_redirect('*/*/edit', array('id' => $this->getrequest()->getparam('id'))); return; } } $this->_redirect('*/*/'); } public function deleteaction() { if( $this->getrequest()->getparam('id') > 0 ) { try { $testmysql4model = mage::getmodel('testmysql4/testmysql4'); $testmysql4model->setid($this->getrequest()->getparam('id'))->delete(); mage::getsingleton('adminhtml/session')->addsuccess(mage::helper('adminhtml')->__('item deleted')); $this->_redirect('*/*/'); } catch (exception $e) { mage::getsingleton('adminhtml/session')->adderror($e->getmessage()); $this->_redirect('*/*/edit', array('id' => $this->getrequest()->getparam('id'))); } } $this->_redirect('*/*/'); } /** * product grid ajax request. * sort , filter result example. */ public function gridaction() { $this->loadlayout(); $this->getresponse()->setbody( $this->getlayout()->createblock('testmysql4/adminhtml_testmysql4_grid')->tohtml() ); } }
in menu have used in url:
<action>adminhtml/testmysql4</action>
magento capitalises first character need rename class namespace_testmysql4_adminhtml_testmysql4controller
(and filename testmysql4controller.php
match) or capitalise action url,
<action>adminhtml/testmysql4</action>
traditionally urls lowercase first option conventional.
Comments
Post a Comment