Magento - 尝试创建新的Adminhtml页面时出错404

时间:2015-02-06 19:10:42

标签: magento admin adminhtml

我正在使用Magento 1.9.0.1,并且我创建了一个新的扩展程序,我在管理面板中添加了一个新标签,看看图片。

enter image description here

以下是我文件中的内容。

在:/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>  

以下是我所拥有的:/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>

以下是我所拥有的:/app/code/community/VivasIndustries/SmsNotification/controllers/Adminhtml/SmsNotification/AboutController.php:

<?php

class VivasIndustries_SmsNotification_Adminhtml_AboutController extends Mage_Adminhtml_Controller_Action
{ 
    public function preDispatch() 
    { 
    return Mage_Adminhtml_Controller_Action::preDispatch(); 
    } 

    public function indexAction() 
    {
        $this->_initAction();
        $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Mage_Core_Block_Template', 'my_block_name_here', array('template' => 'vivasindustries/smsnotification/about.phtml') );
        $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); 
    } 
    protected function _initAction() 
    { 
    parent::_initAction(); 
    $this->_setActiveMenu('smsnotification/about') ->_title(Mage::helper('smsnotification')->__('About')); 
    return $this; 
    } 
}

以下是我所拥有的:/app/design/adminhtml/default/default/template/vivasindustries/smsnotification/about.phtml:

<?php
/**
 * Mage SMS - SMS notification & SMS marketing
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the BSD 3-Clause License
 * It is available through the world-wide-web at this URL:
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * @category    Vivas
 * @package     Vivas_smsnotification
 * @copyright   Copyright (c) 2012-2014 Vivas s.r.o. (http://www.mage-sms.com)
 * @license     http://opensource.org/licenses/BSD-3-Clause
 */
?>
<h2>
<?php 
echo Mage::helper('smsnotification')->__('About'); ?></h2>
<b><?php echo Mage::helper('smsnotification')->__('Mage SMS module 2013-%s, version ', date('Y')).Mage::getConfig()->getModuleConfig('VivasIndustries_SmsNotification')->version; ?></b><br />
<?php echo Mage::helper('smsnotification')->__('Copyright © Vivas s.r.o., All rights reserved'); ?><br /><br />

<b><?php echo Mage::helper('smsnotification')->__('Supported Magento versions:'); ?></b><?php echo Mage::getConfig()->getNode('default/config/supported')->versions; ?><br /><br />

<b><?php echo Mage::helper('smsnotification')->__('Developer:'); ?></b><br /><?php echo Mage::helper('smsnotification')->__('Vivas s.r.o.'); ?><br /><br />

<b><?php echo Mage::helper('smsnotification')->__('Address:'); ?></b><br /><?php echo Mage::helper('smsnotification')->__('B. Nemcove 767/13'); ?><br /><?php echo Mage::helper('smsnotification')->__('78701 Sumperk'); ?><br />
<?php echo Mage::helper('smsnotification')->__('Czech Republic'); ?><br /><?php echo Mage::helper('smsnotification')->__('VAT: CZ29444268'); ?><br /><br /><b><?php echo Mage::helper('smsnotification')->__('Office Telephone:'); ?></b><br />
<?php echo Mage::helper('smsnotification')->__('+420 581 110 998'); ?><br /><br /><b><?php echo Mage::helper('smsnotification')->__('E-mail:'); ?></b><br />

<a href="mailto:<?php echo Mage::helper('smsnotification')->__('sales@Vivas.com'); ?>"><?php echo Mage::helper('smsnotification')->__('sales@Vivas.com'); ?></a><br />
<a href="mailto:<?php echo Mage::helper('smsnotification')->__('support@Vivas.com'); ?>"><?php echo Mage::helper('smsnotification')->__('support@Vivas.com'); ?></a><br /><br />

<b><?php echo Mage::helper('smsnotification')->__('Web:'); ?></b><br />
<a href="http://<?php echo Mage::helper('smsnotification')->__('www.mage-sms.com'); ?>"><?php echo Mage::helper('smsnotification')->__('www.mage-sms.com'); ?></a><br /><br />

<b><?php echo Mage::helper('smsnotification')->__('Facebook:'); ?></b><br /><iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fmagentosms&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;share=true&amp;height=21&amp;appId=242281502635180" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe><br /><br />

<b><?php echo Mage::helper('smsnotification')->__('Manual:'); ?></b><br /><a href="http://<?php echo Mage::helper('smsnotification')->__('www.mage-sms.com/manual.html'); ?>"><?php echo Mage::helper('smsnotification')->__('www.mage-sms.com/manual.html'); ?></a><br /><br />
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'smsnotification/Vivas-logo.gif'; ?>" alt="Vivas" />

当我尝试打开About页面时,我收到错误404。 你能帮我修一下这个错误并告诉我为什么我遇到这个问题?

编辑: 错误图片:

enter image description here

提前致谢!

1 个答案:

答案 0 :(得分:0)

它应该在您的XML文件中。因为您可以在错误页面的底部看到它正在寻找不同的地址( ../ Smsnotification /..// strong>,但您的控制器位于: ../ SMS通知/..)。应该在这一部分:

<about translate="title" module="smsnotification">
                    <title>About</title>
                    <action>adminhtml/smsnotification_about</action>
                    <sort_order>11</sort_order>
</about>

尝试使用smsNotification,看看它是否有效。