【问题标题】:404 error in magento module [closed]magento模块中的404错误[关闭]
【发布时间】:2013-05-24 08:33:42
【问题描述】:

我是 magento 的新成员

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

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

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

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

app/code/local/super/awesome/

etc/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>

etc/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>

Helper/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();

请告诉我模块的后续步骤

请帮帮我,谢谢

【问题讨论】:

  • 您已经解释了更多关于您对 magento 的陌生程度而不是问题!有什么要求?问题是什么?
  • 问题标题与您在此处描述的不匹配。

标签: php magento mysqli magento-1.6


【解决方案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>

【讨论】:

  • 你的cmets肯定会让他更加困惑。他似乎是全新的,可能不了解 ACL。:)
  • 是的,你同意。 :)
  • 是的,我是新人,但我按照您所说的尝试了它,但它不起作用,当我单击子菜单时,它将打开显示 404 错误的前端页面。我尝试制作一个菜单,这部分已经完成,但是当点击菜单时,它在后端将页面显示为产品页面,所以请帮助我
  • 粘贴你的 config.xml ?
  • 我在上面添加文件,您可以从上面检查文件。请告诉我该怎么做
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多