dsfbnhc4373 2014-01-25 09:40
浏览 59
已采纳

创建magento 1.8自定义模块

I have to write a custom login module for magento 1.8, I'm new to magento and after googling I found this tutorial, but there is a big problem
After creating module when I want to load my own page, 404 error occurs
I can't found anything on magento documentations, please help

Here is my code:

/app/code/local/Test/Mymodule/etc/config.xml

<?xml version="1.0" encoding="utf-8"?> 
<config>     
    <modules> 
        <Test_Mymodule> 
            <version>0.1.0</version> 
        </Test_Mymodule> 
    </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 --> 
            <mymodule> 
                <!-- 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>Test_Mymodule</module> 
                    <!-- This parameter sets module alias --> 
                    <frontName>mymodule</frontName> 
                </args> 
            </mymodule> 
        </routers> 
      <layout> 
            <updates>                
                <helloworld>                     
                    <file>mymodule.xml</file> 
                </helloworld> 
            </updates> 
        </layout> 
    </frontend> 
</config>  

/app/etc/modules/Test_Mymodule.xml

<?xml version="1.0" encoding="utf-8"?> 
<config>     
    <modules> 
        <Test_Mymodule> 
           <active>true</active> 
           <codePool>local</codePool> 
        </Test_Mymodule> 
    </modules> 
</config> 

/app/code/local/Test/Mymodule/controllers/IndexController.php

class Test_Mymodule_IndexController extends Mage_Core_Controller_Front_Action 
{ 

   public function indexAction() 
    { 
     echo "test"; 
    } 
}

404 page :(

  • 写回答

1条回答 默认 最新

  • doujian1050 2014-01-25 13:40
    关注

    Finally I found where is the problem, the whole problem is about case-sensitive words in xml files
    my problem is solved simply by replacing <mymodule> by <Mymodule> in config.xml file and the final config.xml looks like this

    <?xml version="1.0" encoding="utf-8"?> 
    <config>     
        <modules> 
            <Test_Mymodule> 
                <version>0.1.0</version> 
            </Test_Mymodule> 
        </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 --> 
                <Mymodule> 
                    <!-- 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>Test_Mymodule</module> 
                        <!-- This parameter sets module alias --> 
                        <frontName>mymodule</frontName> 
                    </args> 
                </Mymodule> 
            </routers> 
          <layout> 
                <updates>                
                    <helloworld>                     
                        <file>mymodule.xml</file> 
                    </helloworld> 
                </updates> 
            </layout> 
        </frontend> 
    </config>   
    

    I really hate magento xml configurations

    Thx to Zvonimir

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ROS Turtlebot3 多机协同自主探索环境时遇到的多机任务分配问题,explore节点
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题