Блок меню администратора Magento не отображается на вкладке конфигурации?

Я новичок в расширениях magento. Я хочу создать новый модуль с именем storeinfo в magento version 1.7.0.2 . Для этого у меня есть структура папок для app/local, такая

magento directory
  app
    code
      community
      core
      local---
            |--- New(foldername)--
                  |---Storeinfo(foldername)--
                        |-Block
                          controllers
                          etc
                          Helper
                          sql

код для New_Storeinfo.xml, который находится внутри magentodirectory/app/etc, примерно такой

 <?xml version="1.0"?>
<config>
  <modules>
    <New_Storeinfo>
      <active>true</active>
      <codePool>local</codePool>
    </New_Storeinfo>
  </modules>
</config>

Теперь внутри каталога magentodirectory/app/code/local/New/Storeinfo/etc/config.xml вот так

<?xml version="1.0"?>
<config>
  <modules>
    <New_Storeinfo>
      <version>0.1.1</version>
    </New_Storeinfo>
  </modules>

  <frontend>
    <routers>
      <storeinfo>
        <use>standard</use>
        <args>
          <module>New_Storeinfo</module>
          <frontName>storeinfo</frontName>
        </args>
      </storeinfo>
    </routers>
    <layout>
      <updates>
        <storeinfo>
          <file>newstoreinfo.xml</file>
        </storeinfo>
      </updates>
    </layout>
  </frontend>

  <adminhtml>
    <acl>
      <resources>
        <all>
          <title>Allow Everything</title>
        </all>
        <admin>
          <children>
            <system>
              <children>
                <config>
                  <children>
                    <storeinfo>
                      <title>Store Map</title>
                    </storeinfo>
                  </children>
                </config>
              </children>
            </system>
          </children>
        </admin>
      </resources>
    </acl>
  </adminhtml>

  <global>
        <models>
            <storeinfo>
                <class>New_Storeinfo_Model</class>
        <resourceModel>storeinfo_mysql4</resourceModel>
            </storeinfo>
        </models>
    <resources>
            <storeinfo_setup>
                <setup>
                    <module>New_Storeinfo</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </storeinfo_setup>
            <storeinfo_write>
                <connection>
                  <use>core_write</use>
                </connection>
            </storeinfo_write>
            <storeinfo_read>
               <connection>
                <use>core_read</use>
              </connection>
            </storeinfo_read>
        </resources>
    <blocks>
            <storeinfo><class>New_Storeinfo_Block</class></storeinfo>
        </blocks>
    <helpers>
            <storeinfo>
                <class>New_Storeinfo_Helper</class>
            </storeinfo>
        </helpers>
    </global>
  <default>
        <storeinfo>
      <address>
        <enabled>1</enabled>
        <title>Our Store Address</title>
        <address>Replace this with Your Address with or without HTML code here....</address>
      </address>
      <storeinfo>
        <enabled>1</enabled>
        <title>Our Location Map</title>
        <map_location>Paste Map HTML code here...</map_location>
      </storeinfo>
    </storeinfo>
    </default>
</config>

Теперь для каталога magentodirectory/app/code/local/New/Storeinfo/etc/system.xml мой код такой

<?xml version="1.0"?>
<config>
    <tabs>
        <storeinfo translate="label" module="storeinfo">
            <label>Store Map &amp; Address</label>
            <sort_order>132</sort_order>
        </storeinfo>
    </tabs>
    <sections>
        <storeinfo translate="label" module="storeinfo">
            <label>Map &amp; Address Info.</label>
            <tab>storeinfo</tab>
            <frontend_type>text</frontend_type>
            <sort_order>100</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <storeinfo translate="label">
                    <label>Settings</label>
                    <comment><![CDATA[
                        <p>
                            <div>Add Store info:</div>
                        </p>
                    ]]></comment>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enabled>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </title>
                        <map_location translate="label">
                            <label>Location Map HTML code</label>
                            <frontend_type>textarea</frontend_type>
                            <sort_order>3</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment><![CDATA[Collect you store map html code from any of the maps code provides like <strong>Google, Yahoo..</strong>]]></comment>
                        </map_location>
                    </fields>
                </storeinfo>
                <address translate="label">
                    <label>Address</label>
                    <comment><![CDATA[
                        <p>
                            <div>Add Store Address to your Magento Store:</div>
                        </p>
                    ]]></comment>
                    <frontend_type>text</frontend_type>
                    <sort_order>2</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enabled>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </title>
                        <address translate="label">
                            <label>Address</label>
                            <frontend_type>textarea</frontend_type>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <comment>Put you store address with or without HTML code</comment>
                        </address>
                    </fields>
                </address>
            </groups>
        </storeinfo>
    </sections>
</config>

Но после всех кодов меню Storeinfo не отображается на вкладке конфигурации администратора magento. Так может ли кто-нибудь любезно сказать мне, в чем здесь проблема? Любая помощь и предложения будут действительно ценными. Спасибо...


person NewUser    schedule 07.08.2013    source источник
comment
вы заходите в систему-->конфигурация-->Дополнительно-->включить Отключение вывода модулей-->проверьте, созданы ли вы модули или нет.   -  person VIVEK-MDU    schedule 07.08.2013
comment
@ VIVEK-MDU да, модуль отображается в расширенном режиме, но он не отображается на вкладке конфигурации. Я много раз пытался включить и отключить его на вкладке «Дополнительно» ... но ничего не происходит ...   -  person NewUser    schedule 07.08.2013
comment
прочитайте эту статью webspeaks.in/2010/08/create -your-first-adminbackend-module.html   -  person VIVEK-MDU    schedule 07.08.2013
comment
У вас есть помощник с именем Data.php в вашей вспомогательной папке? Вы обновили кеш?   -  person Emi    schedule 12.08.2013
comment
да.. в этом у меня мой код такой class New_Storeinfo_Helper_Data extends Mage_Core_Helper_Abstract   -  person NewUser    schedule 12.08.2013
comment
Заархивируйте папку, которая у вас есть, и загрузите ее куда-нибудь, чтобы мы могли ее посмотреть.   -  person Meabed    schedule 12.08.2013
comment
не могли бы вы дать мне свой почтовый идентификатор, чтобы я мог отправить вам модуль...   -  person NewUser    schedule 12.08.2013


Ответы (6)


Ответ на вопрос был дан на magento.stackexchange.com с дополнительными подробностями.
Проблема заключается в объявлении xml файл. Тег <codepool> должен быть <codePool> в верхнем регистре P.

person Marius    schedule 12.08.2013
comment
Я изменил ‹codepool› на ‹codePool› с прописной буквой p, но по-прежнему показывает ту же проблему... проверьте мой обновленный вопрос... - person NewUser; 12.08.2013
comment
Вы очистили кеш?. Я скопировал ваш код на свой локальный экземпляр Magento, и после изменения на <codePool> все заработало. - person Marius; 12.08.2013

удалите приведенный ниже код из config.xml

<adminhtml>
    <acl>
      <resources>
        <all>
          <title>Allow Everything</title>
        </all>
        <admin>
          <children>
            <system>
              <children>
                <config>
                  <children>
                    <storeinfo>
                      <title>Store Map</title>
                    </storeinfo>
                  </children>
                </config>
              </children>
            </system>
          </children>
        </admin>
      </resources>
    </acl>
  </adminhtml>

и создайте файл adminhtml.xml в папке etc с содержимым ниже

<?xml version="1.0"?>
<config>
    <acl>
      <resources>
        <all>
          <title>Allow Everything</title>
        </all>
        <admin>
          <children>
            <system>
              <children>
                <config>
                  <children>
                    <storeinfo>
                      <title>Store Map</title>
                    </storeinfo>
                  </children>
                </config>
              </children>
            </system>
          </children>
        </admin>
      </resources>
    </acl>
  </config>
person Deepak Mallah    schedule 12.08.2013

Я бы предложил использовать генератор для создания большинства базовых вещей, чтобы избежать орфографических ошибок и т. д.

http://www.silksoftware.com/magento-module-creator

person SaveTheMage    schedule 12.08.2013

Если это не опечатка, вы упомянули, что ваш New_Storeinfo.xml находится в:

magentodirectory/app/etc


На самом деле это должно находиться в этой папке:

magentodirectory/app/etc/modules

Обновите кеш, и теперь ваш модуль должен отображаться в разделе «Система» -> «Конфигурация» -> «Дополнительно».

person Jason    schedule 13.08.2013

Попробуйте так. Он используется для создания вкладки меню для администратора magento.

Создайте структуру папок для своих нужд.

затем app/code/local/company_name/module_name/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <JR_CreateAdminController>
            <version>1.0.0</version>
        </JR_CreateAdminController>
    </modules>
    <global>
        <helpers>
            <jr_createadmincontroller>
                <!-- Helper definition needed by Magento -->
                <class>Mage_Core_Helper</class>
            </jr_createadmincontroller>
        </helpers>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <foo_bar before="Mage_Adminhtml">JR_CreateAdminController_Adminhtml</foo_bar>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

затем вы создаете меню панели администратора, используя этот путь app/code/community/company_name/module_name/etc/adminhtml.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <menu>
        <mycustomtab module="jr_createadmincontroller" translate="title">
            <title>My Custom Tab</title>
            <sort_order>100</sort_order>
            <children>
                <index module="jr_createadmincontroller" translate="title">
                    <title>Index Action</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/custom</action>
                </index>
                <list module="jr_createadmincontroller" translate="title">
                    <title>List Action</title>
                    <sort_order>2</sort_order>
                    <action>adminhtml/custom/list</action>
                </list>
            </children>
        </mycustomtab>
    </menu>
    <acl>
        <resources>
            <admin>
                <children>
                    <custom translate="title" module="jr_createadmincontroller">
                        <title>My Controller</title>
                        <sort_order>-100</sort_order>
                        <children>
                            <index translate="title">
                                <title>Index Action</title>
                                <sort_order>1</sort_order>
                            </index>
                            <list translate="title">
                                <title>List Action</title>
                                <sort_order>2</sort_order>
                            </list>
                        </children>
                    </custom>
                </children>
            </admin>
        </resources>
    </acl>
</config>

вы можете создать собственный контроллер для своего модуля app/code/community/company_name/module_name/controllers/Adminhtml/CustomController.php

<?php

class JR_CreateAdminController_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('mycustomtab')
            ->_title($this->__('Index Action'));

        // my stuff

        $this->renderLayout();
    }

    public function listAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('mycustomtab')
            ->_title($this->__('List Action'));

        // my stuff

        $this->renderLayout();
    }
}

и вы хотите создать вкладку конфигурации: создайте system.xml и используйте этот код

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <tabs>
        <inchoo translate="label" module="mymodule">
            <label>Inchoo Extensions</label>
            <sort_order>100</sort_order>
        </inchoo>
    </tabs>
    <sections>
        <inchoo translate="label" module="mymodule">
            <label>Extension Options</label>
            <tab>inchoo</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>
                <inchoo_group translate="label" module="mymodule">
                    <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>
                        <inchoo_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>
                        </inchoo_input>
                        <inchoo_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>
                        </inchoo_select>
                    </fields>
                </inchoo_group>
            </groups>
        </inchoo>
    </sections>
</config>

Я уверен, что это сработает для вас.

person VIVEK-MDU    schedule 07.08.2013

У вас не было этой проблемы, но ради потомков я заметил, что если у вас есть какие-либо комментарии в вашем файле /app/etc/modules/New_Storeinfo.xml, модуль не будет отображаться в System > Configuration > Advanced > Advanced :: Disable Modules Output

person Daniel Flippance    schedule 26.05.2015