0

I have a question.

I would like to rewrite a method of the controller Mage_Checkout_OnepageController.

The method is: saveBillingAction

But I found in other module already a router on this controller. It rewrites the other method.

So i have :

class Mage_Checkout_OnepageController extends Mage_Checkout_Controller_Action
{
...
  /**
     * save checkout billing address
     */
    public function saveBillingAction()
    {
     ...
    }
     protected function _getShippingMethodsHtml()
    {
     ...
    }
}

AN other module :

class Gfi_TNT_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
    protected function _getShippingMethodsHtml()
    {
      ...
    }
}

And I want to crete in my own module :

class Upecom_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
    /**
     * save checkout billing address
     */
    public function saveBillingAction()
    {
      ...
    }
}

Is it possible to do that? I tried with :

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

But it doesn't work sadly :( And I can't modify the gfi tnt controller

Do you have a solution for that?

Cheers

Thomas

0

In such case, you can override the controller which overrides the checkout controller.

controller file

class Upecom_Checkout_OnepageController extends Gfi_TNT_Checkout_OnepageController
{
    /**
     * save checkout billing address
     */
    public function saveBillingAction()
    {
      ...
    }
}

config.xml

<config>
    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <Upecom_Checkout before="Gfi TNT Router name">Upecom_Checkout</Upecom_Checkout>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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