Php 在Magento中添加模块时出现问题

Php 在Magento中添加模块时出现问题,php,magento,module,magento-1.7,Php,Magento,Module,Magento 1.7,我已经通过了两个教程在Magento中添加自定义模块。我对Magento不是很熟悉,但我试着在线遵循这些步骤。 我正在使用Magento 1.7.0.2。 因此,为了将客户模块添加到app/core/local中,我创建了文件夹Mehul/Helloworld 我的Helloworld/etc/config.xml是 <?xml version="1.0" encoding="UTF-8"?> <!-- The root node for Magento module conf

我已经通过了两个教程在Magento中添加自定义模块。我对Magento不是很熟悉,但我试着在线遵循这些步骤。 我正在使用Magento 1.7.0.2。 因此,为了将客户模块添加到app/core/local中,我创建了文件夹Mehul/Helloworld

我的Helloworld/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- The root node for Magento module configuration -->
<config>

    <!--
        The module's node contains basic
        information about each Magento module
    -->
    <modules>

        <!--
            This must exactly match the namespace and module's folder
            names, with directory separators replaced by underscores
        -->
        <Mehul_Helloworld>

            <!-- The version of our module, starting at 0.0.1 -->
            <version>0.0.1</version>

        </Mehul_Helloworld>

    </modules>

      <!-- This node contains parameters, available on frontend --> 
    <frontend> 
        <!-- Module aliases are located in this block --> 
        <routers> 
            <!-- This node's name should be the same as our alias --> 
            <helloworld> 
                <!-- use parameter specifies which of basic routers needs to be used. 
                This can be "standard" for frontend or "admin" for backend --> 
                <use>standard</use> 
                <!-- router arguments block --> 
                <args> 
                    <!-- This parameter specifies the full name of out module --> 
                    <module>Mehul_Helloworld</module> 
                    <!-- This parameter sets module alias --> 
                    <frontName>helloworld</frontName> 
                </args> 
            </helloworld> 
        </routers> 
    </frontend>

</config>
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mehul_Helloworld>

            <!-- Whether our module is active: true or false -->
            <active>true</active>

            <!-- Which code pool to use: core, community or local -->
            <codePool>local</codePool>

        </Mehul_Helloworld>
    </modules>
</config>

0.0.1
标准
Mehul_Helloworld
地狱世界
我的app/etc/Mehul_Helloworld.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- The root node for Magento module configuration -->
<config>

    <!--
        The module's node contains basic
        information about each Magento module
    -->
    <modules>

        <!--
            This must exactly match the namespace and module's folder
            names, with directory separators replaced by underscores
        -->
        <Mehul_Helloworld>

            <!-- The version of our module, starting at 0.0.1 -->
            <version>0.0.1</version>

        </Mehul_Helloworld>

    </modules>

      <!-- This node contains parameters, available on frontend --> 
    <frontend> 
        <!-- Module aliases are located in this block --> 
        <routers> 
            <!-- This node's name should be the same as our alias --> 
            <helloworld> 
                <!-- use parameter specifies which of basic routers needs to be used. 
                This can be "standard" for frontend or "admin" for backend --> 
                <use>standard</use> 
                <!-- router arguments block --> 
                <args> 
                    <!-- This parameter specifies the full name of out module --> 
                    <module>Mehul_Helloworld</module> 
                    <!-- This parameter sets module alias --> 
                    <frontName>helloworld</frontName> 
                </args> 
            </helloworld> 
        </routers> 
    </frontend>

</config>
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mehul_Helloworld>

            <!-- Whether our module is active: true or false -->
            <active>true</active>

            <!-- Which code pool to use: core, community or local -->
            <codePool>local</codePool>

        </Mehul_Helloworld>
    </modules>
</config>

符合事实的
地方的
我的控制器文件'IndexController.php'位于Helloworld/controllers目录中

<?php 

    class Mehul_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {

        public function indexAction()
        {
            echo "Hello tuts+ World";
        }
        public function testAction()
        {
            echo "test action";
        }
    }
?>

我通过管理面板禁用了我的allcatch,并刷新了它。 当我转到系统/配置/高级时,我可以看到我的模块已启用 但我试着把我的控制器看作

mysite.com/helloworld/index/index和 mysite.com/helloworld/index/test 然后我收到一条404错误消息,说找不到该页面

我现在该怎么办

  • 本地的
    • 梅胡尔
      • 地狱世界
        • 控制器
          • IndexController.php
          • config.xml
    • Mehul_Helloworld.xml

嗨,有一个在线的模块创建工具,非常适合新人。此工具将为您提供一个压缩文件。你可以试试这个,看看你犯了什么错误


工具url:

您的文件结构看起来有点奇怪。
它应该是app>code>local和app>etc>modules。从任务描述中,我可以看到本地文件夹与etc文件夹处于同一级别。请检查并修复。还可以尝试在“本地”文件夹名称中使用小写字母。

我认为每件事都是正确的,但您在这里键入的结构不正确。但是“Mehul_Helloworld.xml”文件应该在

“app/etc/modules/Mehul_Helloworld.xml”

而不是

“app/etc/Mehul_Helloworld.xml”

。这可能是您的模块未注册的原因。

app/etc/Mehul\u Helloworld.xml应该是app/etc/modules/Mehul\u Helloworld.xml

您的代码必须输入到


/app/code/local/Mehul/Helloworld/

抱歉,伙计们!!它工作正常,我输入了错误的URL! URL应为“mysite.com/store/helloworld”,因为my magento安装在根目录的saperate存储目录istead中。 我试图访问mysite.com/Helloworld。 我仔细查看了我的目录结构后才意识到这一点!
无论如何,谢谢你们的回复

local
应为
root/app/code
且小写
etc
也应该在
app
文件夹中。尝试连接mysite.com/helloworld/