1

I have default magento mage_customer extend but onestepcheckout on issue.

AW_Onestepcheckout_AjaxController also extend mage_checkout account controller.

so how to extend both account controller.

  1. AW_Onestepcheckout_AjaxController
  2. Mage_Checkout_Controller_Action

my template override function is working.

1 Answer 1

1

You said AW_Onestepcheckout_AjaxController already extends Mage_Checkout_Controller_Action. Now you need to extend both these controllers. For this you just need to make sure your custom module is depending on AW_Onestepcheckout module, so that it will indirectly depend upon the Mage_Checkout. Then you need to include AW_Onestepcheckout_AjaxController before your custom controller. ie

1) Make your custom module depending on the two modules

File : app\etc\modules\Namepace_Modulename.xml

<config>
    <modules>
        <Namepace_Modulename>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <AW_Onestepcheckout />
                <Mage_Checkout />  
            </depends>
        </Namepace_Modulename>
    </modules>
</config>

2) Overwrite External Extension controller

Now you need to overwrite route of AW_Onestepcheckout module, so that, magento will use our custom extension before that external extension.

File : app\code\local\Namespace\Modulaname\etc\config.xml

<config>
    <frontend>
        <routers>
            <aw_onestepcheckout>
                <args>
                    <modules>
                        <namespace_modulename before="AW_Onestepcheckout">Namespace_Modulename</namespace_modulename>
                    </modules>
                </args>
            </aw_onestepcheckout>
        </routers>
    </frontend>
</config>

3) Extend the external external extension's controller with our own controller

Now create custom controller like this.

File : app\code\local\Namespace\Modulename\controllers\CustomController.php

<?php
require_once(Mage::getModuleDir('controllers','AW_Onestepcheckout').DS.'AjaxController.php');

class Namespace_Modulename_CustomController extends AW_Onestepcheckout_AjaxController
{
   // some code
}

Since AW_Onestepcheckout_AjaxController already extends the controller Mage_Checkout_Conrtroller_Action, it will automatically get included, when you extend the external extension's controller

3
  • i have added code but not call function. required rewrite function or not? Sep 23, 2014 at 6:01
  • Sorry, I didnt get you Sep 23, 2014 at 6:07
  • @RajeevKTomy I am having the same problem but the module I want to extend is "gomage_checkout" which is extending Mage_Checkout_Controller_Action,, I followed your method but it didn't helped :(
    – Haris
    Jan 27, 2017 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.