1

I am trying to override community controller(which is overriding core controller) but Its not overriding...
Local module files

<modules>
    <WoofDigital_Enquiry>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            <JakeSharp_Waterlee/>
        </depends>
    </WoofDigital_Enquiry>
</modules>

config.xml

<fronend>
        <routers>
            <jakesharp_waterlee_contacts>
                <args>
                    <modules>
                        <WoofDigital_Enquiry before="JakeSharp_Waterlee">WoofDigital_Enquiry</WoofDigital_Enquiry>
                    </modules>
                </args>
            </jakesharp_waterlee_contacts>
        </routers>
    </fronend>

controllers/Contacts/IndexController.php

require_once 'JakeSharp/Waterlee/controllers/Contacts/IndexController.php';
class WoofDigital_Enquiry_Contacts_IndexController extends JakeSharp_Waterlee_Contacts_IndexController
{
    public function postAction()
    {
        die('Controller override');
    }
}

Community config.xml

<frontend>
    <routers>
        <contacts>
            <args>
                <modules>
                    <jakesharp_waterlee_contacts before="Mage_Contacts">JakeSharp_Waterlee_Contacts</jakesharp_waterlee_contacts>
                </modules>
            </args>
        </contacts>
    </routers>
</frontend>

community Controller

require_once(Mage::getModuleDir('controllers','Mage_Contacts').DS.'IndexController.php');

class JakeSharp_Waterlee_Contacts_IndexController extends Mage_Contacts_IndexController

Anyone who can just put me in right direction because I think I am doing everything right as it required by Magento 1.9.3
Thanks

  • There is a typo mistake in your config.xml. Use <frontend> instead of <fronend> – Jaimin Sutariya Mar 2 '17 at 7:01
  • check error log after trying below solution if it will not solve your issue – Vaibhav Ahalpara Mar 2 '17 at 8:49
  • Its not showing anything in error log, because its going in community controller rather than local controller. – sohaib Mar 14 '17 at 2:28
3

In your module's config.xml

try this-

<frontend>
        <routers>
            <contacts>
                <args>
                    <modules>
                        <WoofDigital_Enquiry before="JakeSharp_Waterlee">WoofDigital_Enquiry</WoofDigital_Enquiry>
                    </modules>
                </args>
            </contacts>
        </routers>
    </frontend>

Instead of

<frontend>
        <routers>
            <jakesharp_waterlee_contacts>
                <args>
                    <modules>
                        <WoofDigital_Enquiry before="JakeSharp_Waterlee">WoofDigital_Enquiry</WoofDigital_Enquiry>
                    </modules>
                </args>
            </jakesharp_waterlee_contacts>
        </routers>
    </frontend>
| improve this answer | |
  • does not work... still going in community controller – sohaib Mar 14 '17 at 2:28

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.