2015-02-05 74 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_”前缀,你的模块配置不完整,有错误或缓存与旧版本和配置缓存必须清除。