Reputation: 1857
I am trying to create a new module for Magento that is only visible from the Admin Area.
I have successfully created the module and have now created a controller called 'editproducts'. In this controller I have indexAction and testAction.
When I go to /quickedit/editproducts/ it loads the indexAction from the controller perfectly fine, however when I go to /quickedit/editproducts/test/ it is redirecting to the dashboard and not calling the testAction. From the tutorials I have seen I appear to have set everything up correctly.
My config.xml file:
<config>
<modules>
<Test_Quickedit>
<version>0.1.0</version>
</Test_Quickedit>
</modules>
<global>
<helpers>
<quickedit>
<class>Test_Quickedit_Helper</class>
</quickedit>
</helpers>
</global>
<admin>
<routers>
<the_name_of_this_element_is_not_important_it_should_be_unique>
<use>admin</use>
<args>
<module>Test_Quickedit</module>
<frontName>quickedit</frontName>
</args>
</the_name_of_this_element_is_not_important_it_should_be_unique>
</routers>
</admin>
<adminhtml>
<menu>
<menu1 translate="title" module="quickedit">
<title>Test</title>
<sort_order>60</sort_order>
<children>
<menuitem1 module="quickedit">
<title>Edit Products</title>
<action>quickedit/editproducts</action>
</menuitem1>
</children>
</menu1>
</menu>
<acl>
<resources>
<admin>
<children>
<catalog>
<children>
<quickedit_editproducts>
<title>Edit Products</title>
</quickedit_editproducts>
</children>
</catalog>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
My EditproductsController.php
class Test_Quickedit_EditproductsController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
echo 'edit products';
}
public function testAction()
{
echo 'test';
}
}
Upvotes: 2
Views: 4695
Reputation: 908
This is just because of the URL which you are redirecting does not contain the Key
If you check the admin modules URL then you see a key is also added in the URL so in order to generate the correct URL use the below code.
$URL = Mage::helper("adminhtml")->getUrl("mymodule/adminhtml_mycontroller/myaction/",array("param1"=>1,"param2"=>2));
or
$URL = Mage::helper("adminhtml")->getUrl("mymodule/adminhtml_mycontroller/myaction/");
Hope this helps!!
Upvotes: 5