2015-02-06 49 views
0

我正在使用Magento 1.9.0.1,並且我創建了一個新的擴展,其中我在管理面板中添加了一個新選項卡,查看圖片。Magento - 如何創建新的管理頁面

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> 

這裏是我在:/應用程序/代碼/社區/ VivasIndustries/SMS通知的/ 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> 

我添加了這三個孩子標籤來創建新的標籤SMS Center但是當我在About選項卡上單擊我得到錯誤404在我的前端。這很尷尬。爲什麼我被重定向到前端?

你能幫我在管理面板中創建一個簡單的新自定義頁面,我想添加一個簡單的文本?

在此先感謝!

回答

2

看起來像Magento認識到你的模塊告訴它「檢查我的admin」控制器,但該Magento沒有找到任何。最好的辦法弄清楚什麼Magento的認爲你的控制器文件應命名爲(以及哪個文件夾應該位於)是一些臨時調試添加到_validateControllerClassName

protected function _validateControllerClassName($realModule, $controller) 
{ 
    $controllerFileName = $this->getControllerFileName($realModule, $controller); 
    if (!$this->validateControllerFileName($controllerFileName)) { 
     var_dump($controllerFileName); //add this line  
     return false; 
    } 

這將轉儲出每個文件Magento的檢查爲控制器。尋找其中包含模塊名稱的行,並比較文件所在位置與Magento認爲應該位於的位置之間的路徑。

+0

我應該在哪個文件中放置此函數?謝謝! – 2015-02-06 21:50:27

+1

你不應該觸摸任何地方,你應該編輯存在於你的Magento核心系統中的_validateControllerClassName函數。快速文本搜索應該可以幫助您找到它。 – 2015-02-06 21:57:00

+0

我找到了它,當我放置它並再次打開「About」頁面時,我收到了以下內容:http://pastebin.com/zzyv41Ed請看看並給我任何建議!提前致謝! – 2015-02-06 22:23:34

相關問題