0

I'm using Magento 1.9.0.1 and i've created a new extension in which i've added a new tab in the admin panel take a look at the picture.

enter image description here

Here is what i have in my files.

In: /app/code/community/VivasIndustries/SmsNotification/etc/config.xml:

<?xml version="1.0"?>
<config>
  <modules>
    <VivasIndustries_SmsNotification>
      <version>0.1.0</version>
    </VivasIndustries_SmsNotification>
  </modules>
  <global>
    <models>
        <smsnotification>
            <class>VivasIndustries_SmsNotification_Model</class>
        </smsnotification>
    </models>  
    <events>
        <sales_order_save_after>
            <observers>
                <vivasindustries_smsnotification>
                    <class>smsnotification/observer</class>
                    <method>orderSaved</method>
                </vivasindustries_smsnotification>
            </observers>
        </sales_order_save_after>
    </events>
    <helpers>
        <smsnotification>
            <class>VivasIndustries_SmsNotification_Helper</class>
        </smsnotification>
        <adminhtml>
            <rewrite>
                <data>VivasIndustries_SmsNotification_Helper_Adminhtml_Data</data>
            </rewrite>
        </adminhtml>
    </helpers>
  </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <VivasIndustries_SmsNotification before="Mage_Adminhtml">VivasIndustries_SmsNotification_Adminhtml</VivasIndustries_SmsNotification>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>  

Here is what i have in: /app/code/community/VivasIndustries/SmsNotification/etc/adminhtml.xml:

<?xml version="1.0"?>
<config>
    <menu>
        <vivassms translate="title" module="smsnotification">
            <title>SMS Center</title>
            <sort_order>110</sort_order>
            <children>
                <sendsms translate="title" module="smsnotification">
                    <title>Send SMS</title>
                    <action>adminhtml/magesms_sendsms</action>
                    <sort_order>1</sort_order>
                </sendsms>
                <settings>
                    <title>Settings</title>
                    <action>adminhtml/system_config/edit/section/vivas/</action>
                    <sort_order>10</sort_order>
                </settings>
                <about translate="title" module="smsnotification">
                    <title>About</title>
                    <action>adminhtml/smsnotification_about</action>
                    <sort_order>11</sort_order>
                </about>
            </children>
        </vivassms>
    </menu>
    <acl>
        <resources>
            <admin>
                <children>
                    <vivassms>
                        <title>SMS</title>
                        <children>
                            <sendsms translate="title" module="smsnotification">
                                <title>Send SMS</title>
                            </sendsms>
                            <settings>
                                <title>Settings</title>
                                <children>
                                    <smsprofile translate="title" module="smsnotification">
                                        <title>Edit user account</title>
                                    </smsprofile>
                                </children>
                            </settings>
                            <about translate="title" module="smsnotification">
                                <title>About</title>
                            </about>
                        </children>
                    </vivassms>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <vivassms translate="title" module="smsnotification">
                                        <title>Vivas SMS</title>
                                    </vivassms>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

I've added these three children tabs to the created new tab SMS Center but when i click on the About tab i got error 404 ON MY FRONTEND. This is awkward. Why i got redirected to the frontend ?

Can you please help me out to create a simple new custom page in the admin panel where i want to add a simple text?

Thanks in advance!

1 Answer 1

2

There are two things you will need to get going: a controller, and proper paths to the controller in your adminhtml.xml.

Here is what you'll need in your controller for the first link:

class VivasIndustries_SmsNotification_Adminhtml_MagesmsController extends Mage_Adminhtml_Controller_Action
{

    /**
     * Grid action for ajax requests
     */
    public function sendsmsAction()
    {
        $this->loadLayout();
        $this->_setActiveMenu('vivassms');
        $this->renderLayout();
    }
}

This will get you a blank page within the Magento admin.

You should also updated your adminhtml from this:

<sendsms translate="title" module="smsnotification">
    <title>Send SMS</title>
    <action>adminhtml/magesms_sendsms</action>
    <sort_order>1</sort_order>
</sendsms>

to this:

<sendsms translate="title" module="smsnotification">
    <title>Send SMS</title>
    <action>adminhtml/magesms/sendsms</action>
    <sort_order>1</sort_order>
</sendsms>
1
  • It worked great for me, i just had to modify the action to something like this: <action>vivasindustries_smsnotification_admin/magesms/sendsms</action> Sep 8, 2017 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.