Magento 1.9.2.1自定义模块404 [英] Magento 1.9.2.1 custom module 404

查看:99
本文介绍了Magento 1.9.2.1自定义模块404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了干净版本的Magento.我有一个自定义模块,该模块可以在旧模块上正常运行,而不能在新模块上正常运行(均为1.9.2.1).它显示在系统"->配置"->高级"->高级"下. 每当我尝试调用mydomain/index.php/cron时.它将重定向到404页面. 我试图添加教程中其余的文件夹:Block,Helper,model和sql.但是没有运气. 正如我所说,它正在使用相同的版本号进行较旧的安装.我只是将整个模块和文件复制到etc文件夹.

I recently installed a clean version of Magento. I had a custom module what was working perfectly on the old one, but not on the new one(Both 1.9.2.1). It shows up under System->Configuration->Advanced->Advanced. When ever i try to call mydomain/index.php/cron. It will redirect to the 404 page. I tried to add the rest of the folders what are in tutorials : Block, Helper,model and sql. But no luck. As i said it is working on the older installation with the same version number. I just copied the whole module and the file to the etc folder.

  • 代码
    • 本地
      • Mxsxs2
        • Cron
          • 控制器
            • IndexController.php
            • code
              • local
                • Mxsxs2
                  • Cron
                    • controllers
                      • IndexController.php
                      • config.xml
                      • 模块
                        • Mxsxs2_Cron.xml
                        • modules
                          • Mxsxs2_Cron.xml

                          app/code/local/Mxsxs2/Cron/etc/config.xml:

                          app/code/local/Mxsxs2/Cron/etc/config.xml:

                                      <?xml version="1.0"?>
                                      <config>
                                         <modules>
                                            <Mxsxs2_Cron>
                                              <version>1.0.0</version>
                                             </Mxsxs2_Cron>
                                         </modules>
                                         <frontend>
                                             <routers>
                                               <cron>
                                                  <use>standard</use>
                                                   <args>
                                                     <module>Mxsxs2_Cron</module>
                                                     <frontName>cron</frontName>
                                                   </args>
                                               </cron>
                                            </routers>
                                         </frontend>
                                      </config>
                          

                          app/code/local/Mxsxs2/Cron/controllers/IndexController.php

                          app/code/local/Mxsxs2/Cron/controllers/IndexController.php

                          <?php
                          class Mxsxs2_Cron_IndexController extends Mage_Core_Controller_Front_Action
                          {
                              public $importfolder="var/import"; 
                              private $errormessages=array();
                              private $READ=null;
                              private $WRITE=null;
                              private $wasindb=0;
                              private $noofwarehouses=3; //for cost check   
                              public function indexAction(){
                                 echo("asd");
                              }
                              //----rest of the code and fucntions they are not important if i remove them it still does not work
                          }
                          

                          app/etc/modules/Mxsxs2_Cron.xml

                          app/etc/modules/Mxsxs2_Cron.xml

                          <?xml version="1.0"?>
                          <config>
                              <modules>
                                  <Mxsxs2_Cron>
                                      <active>true</active>
                                      <codePool>local</codePool>
                                  </Mxsxs2_Cron>
                              </modules>
                          </config>
                          

                          推荐答案

                          尝试更改frontName,它可能会与较新版本的magento发生冲突:

                          Try to change the frontName, it may make some conflicts with newer version of magento :

                          app/code/local/Mxsxs2/Cron/etc/config.xml:
                          
                                  <?xml version="1.0"?>
                                  <config>
                                     <modules>
                                        <Mxsxs2_Cron>
                                          <version>1.0.0</version>
                                         </Mxsxs2_Cron>
                                     </modules>
                                     <frontend>
                                         <routers>
                                           <cron>
                                              <use>standard</use>
                                               <args>
                                                 <module>Mxsxs2_Cron</module>
                                                 <frontName>testname</frontName>
                                               </args>
                                           </cron>
                                        </routers>
                                     </frontend>
                                  </config>
                          

                          清除缓存,然后访问URL mydomain/index.php/testname

                          clear cache then access the url mydomain/index.php/testname

                          这篇关于Magento 1.9.2.1自定义模块404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆