4

My file structure is as follows:

  • Reckless
    • ContactFormSelectors
      • controllers
        • Contacts
          • IndexController.php
      • etc
        • config.xml
      • Helper
        • Data.php

My IndexController.php file is very simple:

<?php

require_once Mage::getModuleDir('controllers', 'Mage_Contacts') . DS . 'IndexController.php';
class Reckless_ContactFormSelectors_IndexController extends Mage_Contacts_IndexController
{

    public function indexAction()
    {
        echo 'here';
        exit;
    }

}

I'd expect the output to be a blank page with 'here' output. This file isn't being loaded at all though, unfortunately.

Here is my config.xml file:

<?xml version="1.0"?>
<config>
    <modules>
        <Reckless_ContactFormSelectors>
            <version>0.0.1</version>
        </Reckless_ContactFormSelectors>
    </modules>
    <frontend>

        <routers>
            <contacts>
                <args>
                    <modules>
                        <Reckless_ContactFormSelectors before="Mage_Contacts">Reckless_ContactFormSelectors</Reckless_ContactFormSelectors>
                    </modules>
                </args>
            </contacts>
        </routers>

    </frontend>

    <global>
        <helpers>
            <Reckless_ContactFormSelectors>
                <class>Reckless_ContactFormSelectors_Helper</class>
            </Reckless_ContactFormSelectors>
        </helpers>
    </global>

</config>

I have an XML file in /app/etc/modules/Reckless_ContactFormSelectors.xml with the content:

<?xml version="1.0"?>
<config>
    <modules>
        <Reckless_ContactFormSelectors>
            <active>true</active>
            <codePool>local</codePool>
        </Reckless_ContactFormSelectors>
    </modules>
</config>

Logs are empty and hold no clues.

Within System > Configuration > Advanced I can see the module and it is enabled.

  • controllers,Block,Helper should be under Reckless>ContactFormSelectors folder – Amit Bera Jul 1 '15 at 13:05
  • @AmitBera apologies - that was my markdown formatting - it's correct, and I've updated the answer – mikemike Jul 1 '15 at 13:13
  • You shouldn't have a sub-dir Contacts under controllers for your Reckless_ContactFormSelectors_IndexController unless you name it Reckless_ContactFormSelectors_Contacts_IndexController and call the action on the URL "contacts/contacts_index/index" – 7ochem Jul 1 '15 at 13:21
7

The way you configured and named the controller the file should reside directly in Reckless > ContactFormSelectors > controllers

Otherwise the definition should have been

<Reckless_ContactFormSelectors before="Mage_Contacts">Reckless_ContactFormSelectors_Contacts</Reckless_ContactFormSelectors>

and the class name

class Reckless_ContactFormSelectors_Contacts_IndexController
  • Sorry, I was originally using before, not after. I changed to after to troubleshoot. I've amended the answer to include 'before' instead. – mikemike Jul 1 '15 at 13:13
  • the problem was, as you said in the update, my folder structure. Can you reflect that in the full answer so I can mark correct? – mikemike Jul 1 '15 at 13:21
  • Updated to resemble the updated question – Fabian Schmengler Jul 1 '15 at 13:24

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.