Thursday, 26 February 2015

Magento – How to override cart controller index action

/app/code/local/Namespace/Cart/etc/config.xml

1. override cart controller

<frontend>
    <routers>
        <checkout>
            <args>
            <modules>
                <Namespace_Cart before = ”Mage_Checkout”>Namespace_Cart_Checkout</Namespace_Cart>
            </modules>
            </args>
        </checkout>
    </routers>
</frontend>

2. /app/code/local/Namespace/Cart/controllers/Checkout/CartController.php

<?php
require_once ‘Mage/Checkout/controllers/CartController.php';

class Namespace_Cart_Checkout_CartController extends Mage_Checkout_CartController
{
    public function indexAction()
    {
        echo ‘file overrided';
        exit;
    }
}

Hope this help....

No comments:

Post a Comment