0

I am overwriting the Mage_Checkout addAction() controller to my local module.But my local module not called, only Mage_Checkout is calling.

My Code

config.xml

<config>
<!-- modules -->
<modules>
    <Manik_Checkout>
        <version>0.1.0</version>
    </Manik_Checkout>
</modules>

<frontend>
    <!-- overriding Mage_Checkout -->
    <routers>
    <checkout>
        <args>
            <modules>
                <Manik_Checkout before="Mage_Checkout">Manik_Checkout</Manik_Checkout>
            </modules>
        </args>
    </checkout>
    </routers>
</frontend>
</config>

IndexController.php

require_once 'Mage/Checkout/controllers/IndexController.php';
class Manik_Checkout_IndexController extends Mage_Checkout_IndexController
{
    function indexAction()
    {
        Mage::log("My Action..");
    }
}

So, how to solve my problem.How to overwrite core controllers to local module.

  • 1
    have you created a file called Manik_Checkout.xml under app/etc/modules/ – Pradeep Sanku Nov 12 '14 at 13:34
1

you have to use like below with routers

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

Also if require in your controller class just add this

IndexController.php should be

require_once 'Mage/Checkout/controllers/IndexController.php';
class Manik_Checkout_IndexController extends Mage_Checkout_IndexController
{

hope this will sure help you.

2

you are missing the <routers>

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

and in the IndexController.php use this code

<?php
    require_once 'Mage/Checkout/controllers/IndexController.php';
    class Manik_Checkout_IndexController extends Mage_Checkout_IndexController
    {
        function indexAction()
        {
            Mage::log("My Action..");
        }

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.