2015-02-05 23 views
1

我使用的是Magento 1.9.0.1,現在我正在處理新的擴展,並且我想在管理面板中添加帶有標籤的新模塊。Magento - Adminhtml配置部分中的新自定義標籤沒有顯示

這裏是我到目前爲止已經完成:

/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> 
    </global> 
    <adminhtml> 
    <acl> 
     <resources> 
      <all> 
       <title>Allow Everything</title> 
      </all> 
      <admin> 
       <children> 
        <system> 
         <children> 
          <config> 
           <children> 
            <vivas> 
             <title>Vivas - All</title> 
            </vivas> 
           </children> 
          </config> 
         </children> 
        </system> 
       </children> 
      </admin> 
     </resources> 
    </acl> 
</adminhtml> 
</config> 

這裏是我有: /app/code/community/VivasIndustries/SmsNotification/etc/system.xml

<?xml version="1.0" encoding="UTF-8"?> 
<config> 
    <tabs> 
     <vivas translate="label" module="vivasindustries_smsnotification"> 
      <label>Vivas Extensions</label> 
      <sort_order>100</sort_order> 
     </vivas> 
    </tabs> 
    <sections> 
     <vivas translate="label" module="vivasindustries_smsnotification"> 
      <label>Extension Options</label> 
      <tab>vivas</tab> 
      <sort_order>1000</sort_order> 
      <show_in_default>1</show_in_default> 
      <show_in_website>1</show_in_website> 
      <show_in_store>1</show_in_store> 

      <groups> 
       <vivas_group translate="label" module="vivasindustries_smsnotification"> 
        <label>My Extension Options</label> 
        <frontend_type>text</frontend_type> 
        <sort_order>1000</sort_order> 
        <show_in_default>1</show_in_default> 
        <show_in_website>1</show_in_website> 
        <show_in_store>1</show_in_store> 

        <fields> 
         <vivas_input translate="label"> 
          <label>My Input Field: </label> 
          <comment>My Comment</comment> 
          <frontend_type>text</frontend_type> 
          <sort_order>20</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>1</show_in_store> 
         </vivas_input> 
         <vivas_select translate="label"> 
          <label>My Dropdown: </label> 
          <comment>Source model provider Magento's default Yes/No values</comment> 
          <frontend_type>select</frontend_type> 
          <sort_order>90</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>1</show_in_store> 
          <source_model>adminhtml/system_config_source_yesno</source_model> 
         </vivas_select> 
        </fields> 
       </vivas_group> 
      </groups> 
     </vivas> 
    </sections> 
</config> 

這裏是我有:/app/code/community/VivasIndustries/SmsNotification/Helper/Data.php:

<?php 
class VivasIndustries_SmsNotification_Helper_Data extends Mage_Core_Helper_Abstract 
{ 

} 

有了這個做我收到以下錯誤,當我打開我的管理面板:

致命錯誤:類「Mage_Vivasindustries_Smsnotification_Helper_Data」不/home/superweb/public_html/store/app/Mage.php發現上線547

當我改變文件夾SmsNotificationSmsnotification這個錯誤消失的名字,但在系統 - >配置任何新的標籤...

所以,球員你能幫我出去科瑞在管理控制檯中有新標籤?

在此先感謝!

回答

3

您忘了在​​3210中爲您的模塊定義輔助別名。它應該是相同的形式爲模特:

<global> 
    <helpers> 
     <smsnotification> 
      <class>VivasIndustries_SmsNotification_Helper</class> 
     </smsnotification> 
    </helpers> 
    ... 

此外,你必須指定用於轉換模塊時使用相同的別名system.xml

module="smsnotification" 

要解釋什麼了發生了: Magento沒有找到別名爲「vivasindustries_smsnotification」的幫手,所以它回落到Mage命名空間和給定的別名用大寫字母作爲模塊(不,我從來沒有見過這種情況下,這將是所需的行爲,但這是它的工作原理)。這導致Mage_Vivasindustries_Smsnotification_Helper_Data作爲無法找到的助手類名稱。

作爲一般規則:如果Magento的試圖從你的模塊加載類與「Mage_」前綴,你的模塊配置不完整,有錯誤或緩存與舊版本和配置緩存必須清除。