2017-07-18 18 views
1

私はコミュニティエクステンションからチェックアウトコントローラを2時間オーバーライドしようとしていますが、まだ動作していません。magentoチェックアウトコミュニティコントローラを書き換える方法

マイカスタムモジュールが有効になっています。 書き換えようとしています(コミュニティ/ Manv/Ajaxcoupon/controllers/Indexcontroller.php) 私のコントローラはここにあります。ここで

require_once 'Manv/Ajaxcoupon/controllers/IndexController.php'; 

    class Name_Promocode_CartController extends Manv_Ajaxcoupon_IndexController 
    { 

     public function customcouponPostAction(){ 
      die('custom'); 
     } 

     public function couponPostAction() 
     { 
      die('We are in'); 
    } 

が私のconfig.xml

キャッシュを削除した
<?xml version="1.0"?> 
<config> 
    <modules> 
     <Name_Promocode> 
      <version>1.0.0</version> 
     </Name_Promocode> 
    </modules> 
    <frontend> 
     <routers> 
      <checkout> 
      <args> 
       <modules> 
       <Name_Promocode before="Manv_Ajaxcoupon">Name_Promocode</Name_Promocode> 
       </modules> 
      </args> 
      </checkout> 
     </routers> 
    </frontend> 
</config> 

です... は、私はコミュニティのモジュールでダイを()入れたとき、私はそれを参照して、間違っているものを見つけることができません。しかし、私のモジュールがanythingsをオーバーライドしていないようです。

答えて

0

は、最後にそれがこのconfig.xmlに

<config> 
    <modules> 
     <Name_Promocode> 
      <version>1.0.0</version> 
     </Name_Promocode> 
    </modules> 
    <frontend> 
     <routers> 
      <name_promocode> 
       <use>standard</use> 
       <args> 
        <module>Name_Promocode</module> 
        <frontName>promocode</frontName> 
       </args> 
      </name_promocode> 
     </routers> 
    </frontend> 
    <global> 
     <rewrite> 
      <name_promocode> 
       <from><![CDATA[#^/ajaxcoupon/index/#]]></from> <!-- the URL which u want to override--> 
       <to>/promocode/cart/</to> <!-- destination url --> 
      </name_promocode> 
     </rewrite> 
    </global> 
</config> 

希望トンと連携作ら彼は誰かを助けるでしょう:D

0

//以下のconfig.xmlコードと比較してみてください。

<config> 
    <frontend> 
     <routers> 
      <checkout> 
       <args> 
        <modules> 
         <name_promocode before="Mage_Tag">Manv_Ajaxcoupon</name_promocode> 
        </modules> 
       </args> 
      </tag> 
     </routers> 
    </frontend> 
</config> 

//代替オーバーライドコントローラコード。

<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 --> 
      <customcontactsunique> 
       <from><![CDATA[#^/contacts/index/#]]></from> 
       <!-- 
        - mymodule matches the router frontname below 
        - matches the path to your controller 

        Considering the router below, "/customcontacts/index/" will be 
        "translated" to "app/code/local/Amit/Customcontacts/controllers/IndexController.php" (?) 
       --> 
       <to>/customcontacts/index/</to> 
      </customcontactsunique> 
     </rewrite> 
    </global> 

//コントローラのコードを比較します。

require_once(Mage::getModuleDir('controllers','Manv_Ajaxcoupon').DS.'IndexController.php'); 

class Name_Promocode_CartController extends Manv_Ajaxcoupon_IndexController 
{ 
    // some code 
} 

More reference

Alternate override controller link

+0

私は今それを試してみます – Ggs

+0

これは私がいくつかの上のcharを持っていたの後にしました。それらを変更:<= "Manv_Ajaxcoupon" 前wishibam_promocode> Wishibam_Promocode ' \t \t \t \t \t \t \t \t \t \t \t \t \t \t \tあなたの側から勤務 \t \t \t ' – Ggs

+0

? –

0

これを試してみてください:

<config> 
    <modules> 
     <Name_Promocode> 
      <version>1.0.0</version> 
     </Name_Promocode> 
    </modules> 
    <frontend> 
     <routers> 
      <name_promocode> 
       <use>standard</use> 
       <args> 
        <module>Name_Promocode</module> 
        <frontName>promocode</frontName> 
       </args> 
      </name_promocode> 
     </routers> 
    </frontend> 
    <global> 
     <rewrite> 
      <name_promocode> 
       <from><![CDATA[#^/ajaxcoupon/index/#]]></from> <!-- the URL which u want to override--> 
       <to>/promocode/cart/</to> <!-- destination url --> 
      </name_promocode> 
     </rewrite> 
    </global> 
</config> 
関連する問題