Problem in getting url of custom module
-
13-12-2019 - |
Question
I am new to magento,I have created a custom module for magento backend. I don't know how to get its url, I have tried some help from online, nothing happens, please tell what should I pass into getUrl function.How should I use $url = Mage::helper("adminhtml")->getUrl('/your_module/index'); my file
confic.xml
<modules>
<Petra_DailyOrders>
<version>1.0.0</version>
</Petra_DailyOrders>
</modules>
<global>
<helpers>
<petra_dailyorders>
<!-- Helper definition needed by Magento -->
<class>Mage_Core_Helper</class>
</petra_dailyorders>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<petra_dailyorders before="Mage_Adminhtml">Petra_DailyOrders_Adminhtml</petra_dailyorders>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<petra>
<file>dailyorders.xml</file>
</petra>
</updates>
</layout>
</adminhtml>
Solution
generate it like this:
$url = Mage::helper("adminhtml")->getUrl('admintml/your_module/index');
So you should place your controller in
Petra/DailyOrders/controllers/Adminhtml/ControllerName.php
and call it like this
$url = Mage::helper("adminhtml")->getUrl('admintml/controllername/index');
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange