magento模块中的404错误

时间:2013-05-24 08:33:42

标签: php magento mysqli magento-1.6

我是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安装-0.1.0.php

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

请告诉我模块的后续步骤

请帮助我,谢谢

1 个答案:

答案 0 :(得分: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>