php - Magento - Admin URL Shows Front End 404 (Csutom Module) -
i creating magento module allow products reported. have done front end okay , working there.
i have come create admin area module , having lot of trouble. when click on menu item module (catalog > reported products), renders front end of website. (the url expected though "domain.com/index.php/admin/reported_products/adminhtml/key/76f4724a69.../"). displays 404 page.
i've tried lot of variations on action of menu item nothing has worked. i've changed front_name
under admin
node, nothing :/
i'll try present files in nice order...
app/code/local/tbe/report/etc/config.xml
<modules> <tbe_report> <version>0.1.0</version> </tbe_report> </modules> <global> <helpers> <report> <class>tbe_report_helper</class> </report> </helpers> <blocks> <report> <class>tbe_report_block</class> </report> </blocks> <models> <report> <class>tbe_report_model</class> <resourcemodel>report_mysql4</resourcemodel> </report> <report_mysql4> <class>tbe_report_model_mysql4</class> <entities> <report> <table>report</table> </report> </entities> </report_mysql4> </models> <resources> <report_setup> <setup> <module>tbe_report</module> </setup> <connection> <use>core_setup</use> </connection> </report_setup> <report_write> <connection> <use>core_write</use> </connection> </report_write> <report_read> <connection> <use>core_read</use> </connection> </report_read> </resources> </global> <frontend> <routers> <report> <use>standard</use> <args> <module>tbe_report</module> <frontname>report</frontname> </args> </report> </routers> <layout> <updates> <report> <file>report.xml</file> </report> </updates> </layout> </frontend> <adminhtml> <routers> <report> <use>admin</use> <args> <module>tbe_report</module> <frontname>reported_products</frontname> </args> </report> </routers> <admin> <routers> <adminhtml> <args> <modules> <tbe_report after="mage_adminhtml">tbe_report</tbe_report> </modules> </args> </adminhtml> </routers> </admin> </adminhtml>
app/code/local/tbe/report/etc/adminhtml.xml
<?xml version="1.0"?> <config> <menu> <catalog translate="title" module="report"> <title>catalog</title> <sort_order>30</sort_order> <children> <report> <title>reported products</title> <sort_order>100</sort_order> <action>adminhtml/reported_products/reported/</action> </report> </children> </catalog> </menu> <acl> <resources> <admin> <children> <tbe translate="title" module="report"> <title>view reported products</title> <sort_order>1</sort_order> </tbe> </children> </admin> </resources> </acl> </config>
app/code/core/local/tbe/report/controllers/reportedcontroller.php
class tbe_report_reportedcontroller extends mage_adminhtml_controller_action { public function indexaction() { $this->loadlayout(); $this->renderlayout(); } }
yes, have blank data.php under tbe/report/helpers/
any , appreciated.
update
i have managed working (somewhat). issue <action>
node in adminhtml.xml.
if not prepend action adminhtml
, page renders, showing admin header , footer (i haven't done content yet). however, url not contain /admin. instead, url "http://domain.com/index.php/reported_products/reported/key/88bf4.../".
if prepend action adminhtml
, renders front end header , footer goes correct url "http://domain.com/index.php/admin/reported_products/reported/key/88bf4.../".
i url /admin. here's updated code:
app/code/local/tbe/report/etc/config.xml
<?xml version="1.0"?> <config> ... <!-- nothing has changed here --> <!-- have gotten rid of <adminhtml> node --> <frontend> <routers> <report> <use>standard</use> <args> <module>tbe_report</module> <frontname>report</frontname> </args> </report> </routers> <layout> <updates> <report> <file>report.xml</file> </report> </updates> </layout> </frontend> <admin> <routers> <tbe_report> <use>admin</use> <args> <module>tbe_report</module> <frontname>reported_products</frontname> <modules> <tbe_report after="mage_adminhtml">tbe_report_reported</tbe_report> </modules> </args> </tbe_report> </routers> </admin> </config>
app/code/local/tbe/report/etc/adminhtml.xml
<?xml version="1.0"?> <config> <menu> <catalog translate="title" module="report"> <title>catalog</title> <sort_order>30</sort_order> <children> <report> <title>reported products</title> <sort_order>100</sort_order> <action>adminhtml/reported_products/reported/index</action> </report> </children> </catalog> </menu> ... </config>
app/code/local/tbe/report/controllers/reportedcontroller.php
class tbe_report_reportedcontroller extends mage_adminhtml_controller_action { public function indexaction() { $this->loadlayout(); $this->renderlayout(); } }
since controller in /tbe/report/controllers/adminhtml/indexcontroller.php , not /tbe/report/controllers/indexcontroller.php therefore need use <tbe_report after="mage_adminhtml">tbe_report_adminhtml<...
try
<admin> <routers> <adminhtml> <args> <modules> <tbe_report after="mage_adminhtml">tbe_report_adminhtml</tbe_report> </modules> </args> </adminhtml>
assuming following folder structure.
app/code/local/tbe/report/controllers/adminhtml/reportedcontroller.php
menu
<action>adminhtml/reported/index/</action>
Comments
Post a Comment