0

I am trying to override Magento Core CartController, But the core CartController is loading config.xml (inside community/Company/BnOverride/etc/)

<?xml version="1.0"?>
<config>
    <modules>
        <Company_BnOverride>
            <version>0.1.0</version>
        </Company_BnOverride>
    </modules>
    <frontend>
        <routers>
          <checkout>
                <args>
                    <modules>
                        <company_bnoverride before="Mage_Checkout">Company_BnOverride</company_bnoverride>
                    </modules>
                </args>
           </checkout>
        </routers>
    </frontend>
</config>

CartController.php inside (community/Company/BnOverride/controllers/)

<?php 
require_once 'Mage/Checkout/controllers/CartController.php';
class Company_BnOverride_CartController extends Mage_Checkout_CartController
{
    /**
     * Shopping cart display action
     */
    public function indexAction()
    {

        echo "Cart page";
        exit;
 }

And Company_BnOverride.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_BnOverride>
            <active>true</active>
            <codePool>community</codePool>
        </Company_BnOverride>
    </modules>
</config>

3 Answers 3

0

Replace Code in Config.xml file with :

<checkout>
     <args>
         <modules>
             <Company_Bnoverride before="Mage_Checkout">Company_BnOverride</Company_Bnoverride>
         </modules>
     </args>
 </checkout>

Also Replace Company_BnOverride.xml File

<?xml version="1.0"?>
<config>
    <modules>
        <Company_BnOverride>
            <active>true</active>
            <codePool>community</codePool>
        </Company_BnOverride>
    </modules>
</config>
4
  • Thank you for your response. I made the changes but still not loading the extended controller Commented Jan 3, 2017 at 11:03
  • Go for the Edited Answer Commented Jan 3, 2017 at 11:04
  • Edited : config.xml file go for that. Commented Jan 3, 2017 at 11:17
  • 1
    @user2638108:you can also upvote my answer Commented Jan 3, 2017 at 12:38
2

change

<company_bnoverride before="Mage_Checkout_Cart">Company_BnOverride</company_bnoverride>

to

<company_bnoverride before="Mage_Checkout">Company_BnOverride</company_bnoverride>
2
  • Thank you for your response. I made the changes but still not loading the extended controller Commented Jan 3, 2017 at 11:02
  • @user2638108 try with <Company_BnOverride before="Mage_Checkout">Company_BnOverride</Company_BnOverride> also check example magento.stackexchange.com/questions/71598/… Commented Jan 3, 2017 at 11:15
0

Replace your controller frontend xml code with below one,

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

You have to keep only Mage_Checkout instead of Mage_Checkout_Cart

Just keep Module name declaration of override module. Here in your case is checkout module.

3
  • Thank you for your response. I made the changes but still not loading the extended controller Commented Jan 3, 2017 at 11:02
  • <mage_checkout before="Mage_Checkout">Company_BnOverride</mage_checkout> try with this Commented Jan 3, 2017 at 11:06
  • You can close this question after accept any one answer. Thanks. Commented Jan 3, 2017 at 11:14

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.