-1

我是 magento 的新手

使用模块和另一个模块在客户组中添加列或字段,例如具有添加、编辑或删除选项的产品

我搜索了这个,但没有找到具体的答案如何使用模块来完成,因为所有关于编辑 magento 内置文件的答案

所以请告诉我如何创建一个模块,在管理面板的客户组中添加一个字段,存储值以及如何使用 php 在前端检索该值

我尝试制作一个模块,这里我的文件是

应用程序/代码/本地/超级/真棒/

等/config.xml

<config>
<modules>
    <Super_Awesome>
        <version>0.1.0</version>
    </Super_Awesome>
</modules>
<adminhtml>
    <!-- The <layout> updates allow us to define our block layouts in a seperate file so are aren't messin' with the magento layout files.  -->
    <layout>
        <updates>
            <awesome>
                <file>awesome.xml</file>
            </awesome>
        </updates>
    </layout>
    <!-- The <acl> section is for access control. Here we define the pieces where access can be controlled within a role. -->
    <acl>
        <resources>
            <admin>
                <children>
                    <awesome>
                        <title>Awesome Menu Item</title>
                        <children>
                            <example translate="title" module="awesome">
                                <title>Example Menu Item</title>
                            </example>
                        </children>
                    </awesome>
                </children>
            </admin>
        </resources>
    </acl>
</adminhtml>
<admin>
    <!--
        Here we are telling the Magento router to look for the controllers in the Super_Awesome_controllers_Adminhtml before we look in the
        Mage_Adminhtml module for all urls that begin with /admin/controller_name
     -->
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <awesome before="Mage_Adminhtml">Super_Awesome_Adminhtml</awesome>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

<global>
    <models>
        <awesome>
            <class>Super_Awesome_Model</class>
            <resourceModel>awesome_mysql4</resourceModel>
        </awesome>
         <awesome_mysql4>
            <class>Super_Awesome_Model_Mysql4</class>
            <entities>
                <example>
                    <table>Super_Awesome_example</table>
                </example>
            </entities>
        </awesome_mysql4>
    </models>

    <resources>
        <awesome_setup>
            <setup>
                <module>Super_Awesome</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </awesome_setup>
        <awesome_write>
            <connection>
                <use>core_write</use>
            </connection>
        </awesome_write>
        <awesome_read>
            <connection>
                <use>core_read</use>
            </connection>
        </awesome_read>
    </resources>

    <blocks>
        <awesome>
            <class>Super_Awesome_Block</class>
        </awesome>
    </blocks>
    <helpers>
        <awesome>
            <class>Super_Awesome_Helper</class>
        </awesome>
    </helpers>
</global>

等/adminhtml.xml

<config>
<menu>
    <awesome translate="title" module="awesome">
        <title>Awesome</title>
        <sort_order>15</sort_order>
        <children>
            <example translate="title" module="awesome">
                <title>Example</title>
                <sort_order>1</sort_order>
                <action>adminhtml/example/index</action>
            </example>
        </children>
    </awesome>
</menu>

助手/Data.php

class Super_Awesome_Helper_Data extends Mage_Core_Helper_Abstract{}

sql/awesome_setup/mysql4-install-0.1.0.php

$installer = $this;$installer->startSetup();$installer->run("");$installer->endSetup();

请告诉我模块的后续步骤

请帮助我,谢谢

4

1 回答 1

1
  • 注销/重新登录
  • 确保在模块的 XML 配置中为菜单项定义了 ACL。

您在配置中的菜单应如下所示

<menu>
    <custommodule translate="title" module="custommodule">
        <title>Custom Module</title>
        <sort_order>100</sort_order>
        <children>
            <custommodule translate="title" module="custommodule">
                <title>Custom Module</title>
                <sort_order>101</sort_order>
                <children>
                    <custommodule1 translate="title" module="custommodule">
                        <title>Custom Module1</title>
                        <action>custommodule/adminhtml_event</action>
                        <sort_order>102</sort_order>
                    </custommodule1>

                </children>
            </custommodule>
        </children>
    </custommodule>
</menu>

config.xml(或 admintml)中的 ACL 应如下所示:

<acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>

            <children>
                <custommodule translate="title" module="custommodule">
                    <title>Custom Module</title>
                    <sort_order>100</sort_order>

                    <children>
                        <custommodule translate="title">
                            <title>Custom Module</title>
                            <sort_order>101</sort_order>
                            <children>
                                <custommodule1 translate="title" module="custommodule">
                                    <title>Custom Module1</title>
                                </custommodule1>

                            </children>
                        </custommodule>
                    </children>
                </custommodule>

            </children>
        </admin>
    </resources>
</acl>
于 2013-05-24T08:41:21.407 回答