skip to Main Content

I have searched and implemented many answers from stackoverflow but I am not able to override the controller. The question is quite self-explanatory but I will provide the codes to show what I am doing. Maybe someone can guide me in the right direction:

This is my directory structure

This is my config.xml inside etc folder.

<?xml version="1.0"?>
<config>
<modules>
    <Zepcom_Checkout>
        <version>0.0.1</version>
    </Zepcom_Checkout>
</modules>
<frontend>
    <routers>
        <checkout>
            <args>
                <modules>
                    <Zepcom_Checkout before="Mage_Checkout">Zepcom_Checkout</Zepcom_Checkout>
                </modules>
            </args>
        </checkout>
    </routers>
</frontend>

And this is my controller

require_once 'Mage/Checkout/controllers/OnepageController.php';


class Zepcom_Checkout_OnepageController extends Mage_Checkout_OnepageController {
      public function indexAction() {
         var_dump("custom"); die;
      }
.
.  // some overriding code here
.
}

I am really stuck and any help would be appreciated. I am doing a dump to verify the calling of the controller but it keeps calling the Core controller.

2

Answers


  1. You will need to declare a router “routeurfrontend” which is actually the route used by Magento to access your controller.

    <?xml version="1.0"?>
    <config>
        <frontend>
            <routers>
                <zepcom_checkout>
                    <use>standard</use>
                    <args>
                        <module>Zepcom_Checkout</module>
                        <frontName>zepcom_checkout</frontName>
                    </args>
                </zepcom_checkout>
                <checkout>
                    <args>
                        <modules>
                            <Zepcom_Checkout before="Mage_Checkout">Zepcom_Checkout</Zepcom_Checkout>
                        </modules>
                    </args>
                </checkout>
            </routers>
        </frontend>
    </config>
    
    Login or Signup to reply.
  2. You are missing the </config> closing tag in your config.xml

    <?xml version="1.0"?>
    <config>
        <modules>
            <Zepcom_Checkout>
                <version>0.0.1</version>
            </Zepcom_Checkout>
        </modules>
        <frontend>
            <routers>
                <checkout>
                    <args>
                        <modules>
                            <Zepcom_Checkout before="Mage_Checkout">Zepcom_Checkout</Zepcom_Checkout>
                        </modules>
                    </args>
                </checkout>
            </routers>
        </frontend>
    </config>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search