Блокът на администраторското меню на 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
отивате на system--›configuration--›Advanced--› enable Disable Modules Output--› проверете дали сте създали модулите или не.   -  person VIVEK-MDU    schedule 07.08.2013
comment
@VIVEK-MDU да, модулът се показва в разширен, но не се показва в раздела за конфигурация. Опитвал съм много пъти да го направя на и ff от разширения раздел.. но нищо не се случва...   -  person NewUser    schedule 07.08.2013
comment
прочетете тази статия webspeaks.in/2010/08/create -вашият-първи-adminbackend-module.html   -  person VIVEK-MDU    schedule 07.08.2013
comment
и също така прочетете това inchoo.net/ecommerce/magento/   -  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