<i id='DPvmF'><tr id='DPvmF'><dt id='DPvmF'><q id='DPvmF'><span id='DPvmF'><b id='DPvmF'><form id='DPvmF'><ins id='DPvmF'></ins><ul id='DPvmF'></ul><sub id='DPvmF'></sub></form><legend id='DPvmF'></legend><bdo id='DPvmF'><pre id='DPvmF'><center id='DPvmF'></center></pre></bdo></b><th id='DPvmF'></th></span></q></dt></tr></i><div id='DPvmF'><tfoot id='DPvmF'></tfoot><dl id='DPvmF'><fieldset id='DPvmF'></fieldset></dl></div>

    <small id='DPvmF'></small><noframes id='DPvmF'>

  • <legend id='DPvmF'><style id='DPvmF'><dir id='DPvmF'><q id='DPvmF'></q></dir></style></legend>

    • <bdo id='DPvmF'></bdo><ul id='DPvmF'></ul>

    1. <tfoot id='DPvmF'></tfoot>

        覆盖 Magento 社区模块控制器的问题

        Problems Overriding Magento Community Module Controller(覆盖 Magento 社区模块控制器的问题)
        <i id='GN6nQ'><tr id='GN6nQ'><dt id='GN6nQ'><q id='GN6nQ'><span id='GN6nQ'><b id='GN6nQ'><form id='GN6nQ'><ins id='GN6nQ'></ins><ul id='GN6nQ'></ul><sub id='GN6nQ'></sub></form><legend id='GN6nQ'></legend><bdo id='GN6nQ'><pre id='GN6nQ'><center id='GN6nQ'></center></pre></bdo></b><th id='GN6nQ'></th></span></q></dt></tr></i><div id='GN6nQ'><tfoot id='GN6nQ'></tfoot><dl id='GN6nQ'><fieldset id='GN6nQ'></fieldset></dl></div>

        <small id='GN6nQ'></small><noframes id='GN6nQ'>

        1. <tfoot id='GN6nQ'></tfoot>

              <bdo id='GN6nQ'></bdo><ul id='GN6nQ'></ul>

                <legend id='GN6nQ'><style id='GN6nQ'><dir id='GN6nQ'><q id='GN6nQ'></q></dir></style></legend>
                    <tbody id='GN6nQ'></tbody>
                  本文介绍了覆盖 Magento 社区模块控制器的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  首先,这里的答案非常有帮助:在社区扩展中覆盖 Magento 控制器

                  First of all, the Answer here is very helpful: Overriding a Magento Controller in community extention

                  然而,尽管通过了答案中提到的两个测试",我仍然有一个模块控制器覆盖,它只是拒绝工作.这是我所拥有的:

                  However, despite passing both of the "tests" mentioned in the answer there, I still have a module controller override that just refuses to work. Here is what I have:

                  appcodelocalCompanyOnepageCheckoutetcconfig.xml

                  <?xml version="1.0"?>
                  <config>
                      <modules>
                          <Company_OnepageCheckout>
                              <version>0.0.1</version> 
                          </Company_OnepageCheckout>
                      </modules>
                      <frontend>
                          <routers>
                              <onepagecheckout>
                                  <args>
                                      <modules>
                                          <company_onepagecheckout before="IWD_OnepageCheckout">Company_OnepageCheckout</company_onepagecheckout>
                                      </modules>
                                  </args>
                              </onepagecheckout>
                          </routers>
                      </frontend>
                  </config>
                  

                  appcodelocalCompanyOnepageCheckoutcontrollersIndexController.php

                  <?php
                  
                  require_once(Mage::getModuleDir('controllers','IWD_OnepageCheckout').DS.'IndexController.php');
                  
                  class Company_OnepageCheckout_IndexController extends IWD_OnepageCheckout_IndexController
                  {
                      function indexAction() {
                          die('Hello world!');
                      }
                  }
                  

                  appetcmodulesCompany_OnepageCheckout.xml

                  <?xml version="1.0"?>
                  <config>
                      <modules>
                          <Company_OnepageCheckout>
                              <active>true</active>
                              <codePool>local</codePool>
                              <depends>
                                  <IWD_OnepageCheckout />
                              </depends>
                          </Company_OnepageCheckout>
                      </modules>
                  </config>
                  

                  此模块旨在覆盖位于 appcodecommunityIWDOnepageCheckout[...]

                  正如本文开头所提到的,我已经按照其他问题中的建议使用了 Reflection 类,并且可以在社区模块之前的数组中首先看到我的模块.但是,当我访问 mysite.com/onepagecheckout 时,我仍然看到社区模块,并且无法让它使用我的文件.

                  As mentioned at the top of this post, I've used the Reflection class as suggested in that other Question and can see my module first in the array ahead of the community module. However, when I visit mysite.com/onepagecheckout I still see the community module, and can't get it to use my file.

                  我的直觉是,这可能与我遗漏的模块名称的大写有关.

                  推荐答案

                  只需更改

                  <company_onepagecheckout before="IWD_OnepageCheckout">Company_OnepageCheckout</company_onepagecheckout> 
                  

                  <Company_OnepageCheckout before="IWD_OnepageCheckout">Company_OnepageCheckout</Company_OnepageCheckout>
                  

                  如果它不起作用则使用

                  <global>
                          <!-- This rewrite rule could be added to the database instead -->
                          <rewrite>
                              <!-- This is an identifier for your rewrite that should be unique -->
                              <!-- THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER -->
                              <mynamespace_mymodule_onepage_iwd>
                                  <from><![CDATA[#^/onepagecheckout/index/#]]></from>
                                  <!--
                                      - mymodule matches the router frontname below
                                      - checkout_cart matches the path to your controller
                  
                                      Considering the router below, "/mymodule/checkout_car/" will be
                                      "translated" to "/MyNameSpace/MyModule/controllers/Checkout/CartController.php" (?)
                                  -->
                                  <to>/comonepagecheckout/index/</to>
                              </mynamespace_mymodule_onepage_iwd>
                          </rewrite>
                      </global>
                  <frontend>
                          <routers>
                              <comonepagecheckout>
                                  <!-- should be set to "admin" when overloading admin stuff (?) -->
                                  <use>standard</use>
                                  <args>
                                      <module>Company_OnepageCheckout</module>
                                      <!-- This is used when "catching" the rewrite above -->
                                      <frontName>comonepagecheckout</frontName>
                                  </args>
                              </comonepagecheckout>
                          </routers>
                      </frontend>
                  

                  See more at

                  这篇关于覆盖 Magento 社区模块控制器的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)

                        <i id='GOvl2'><tr id='GOvl2'><dt id='GOvl2'><q id='GOvl2'><span id='GOvl2'><b id='GOvl2'><form id='GOvl2'><ins id='GOvl2'></ins><ul id='GOvl2'></ul><sub id='GOvl2'></sub></form><legend id='GOvl2'></legend><bdo id='GOvl2'><pre id='GOvl2'><center id='GOvl2'></center></pre></bdo></b><th id='GOvl2'></th></span></q></dt></tr></i><div id='GOvl2'><tfoot id='GOvl2'></tfoot><dl id='GOvl2'><fieldset id='GOvl2'></fieldset></dl></div>
                          <tbody id='GOvl2'></tbody>
                        • <bdo id='GOvl2'></bdo><ul id='GOvl2'></ul>
                          • <tfoot id='GOvl2'></tfoot>

                            <small id='GOvl2'></small><noframes id='GOvl2'>

                          • <legend id='GOvl2'><style id='GOvl2'><dir id='GOvl2'><q id='GOvl2'></q></dir></style></legend>