1
votes

I have a problem overriding the controller:

\app\code\core\Mage\Checkout\controllers\OnepageController.php

I tried to do it by creating new file here:

\app\code\local\Mage\Checkout\controllers\OnepageController.php

nothing happened.

Then I tried to do it by creating new plugin :

path : \app\etc\modules\MyExtensions_Checkout.xml

<config>
<modules>
    <MyExtensions_Checkout>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            <Mage_Checkout/>
        </depends>
    </MyExtensions_Checkout>
</modules>

path : \app\code\local\MyExtensions\etc\config.xml

<frontend>
    <routers>
        <checkout>
            <args>
                <modules>
                    <MyExtensions_Checkout before="Mage_Checkout">MyExtensions_Checkout</MyExtensions_Checkout>
                </modules>
            </args>
        </checkout>
    </routers>
</frontend>

path: app\code\local\MyExtensions\Checkout\controllers\CartController.php

class MyExtensions_Checkout_CartController extends Mage_Checkout_Controller_Action{}

Module is appearing in admin panel but overriding still doesn't work. What is wrong with my code ? Thx in advance.

2
what are you trying to override out of it? - Goku
Just removing some lines I don't need. Is it matter somehow ? I can't write it here in comment because it's too long but basicaly I'm removing shiping method. - Victor Eliot
Basically, if you override attemp in local pool have failed, it's because, another module is overriding it. Try to disable this one and test again. - Max Bongiorno
@MaxBongiorno Thank you it was good idea to check module conflicts, I disabled all installed ones but unfortunately it still doesn't work. - Victor Eliot

2 Answers

0
votes

path : \app\etc\modules\MyExtensions_Checkout.xml

<?xml version="1.0"?>
 <config>
  <modules>
    <MyExtensions_Checkout>
     <version>1.0</version>
    </MyExtensions_Checkout>
  </modules>

  <frontend>
   <routers>
    <checkout>
     <args>
      <modules>
        <MyExtensions_Checkout before="Mage_Checkout">MyExtensions_Checkout</MyExtensions_Checkout>
      </modules>
     </args>
    </checkout>
   </routers>
 </frontend>
 </config>

path: app\code\local\MyExtensions\Checkout\controllers\OnepageController.php

require_once 'Mage/Checkout/controllers/OnepageController.php';
class MyExtensions_Checkout_OnepageController extends Mage_Checkout_Controller_Action{}
0
votes

Issue fixed.

I'm sorry, that was my fault, I had one more folder inside my Extention So I just changed :

path : \app\code\local\MyExtensions\etc\config.xml

to

path : \app\code\local\MyExtensions\Checkout\etc\config.xml

Thank you everyone for help!