1

I'm trying to overload the newsletter controller so that I can add in extra fields for the newsletter page. I'm basing my module on this code where the author just updates the core file (yuck): http://justonestepsolution.blogspot.co.uk/2012/08/add-firstlast-name-in-newsletter-module.html

At the moment, i'm just trying to get the newsletter to use my extended class, but it's not working for some reason. I've cleared the cache etc and can see the module is loaded in admin > configuration > advanced

So here's my code:

app/code/local/Skywire/Newsletter/etc/config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Skywire_Newsletter>
            <version>0.1.0</version>
        </Skywire_Newsletter>
    </modules>
    <frontend>
        <routers>
            <newsletter>
                <args>
                    <modules>
                        <Skywire_Newsletter before="Mage_Newsletter_SubscriberController">Skywire_Newsletter</Skywire_Newsletter>
                    </modules>
                </args>
            </newsletter>
        </routers>
    </frontend>
</config>

app/code/local/Skywire/Newsletter/controllers/SubscribeController.php:

<?php
include_once("Mage/Newsletter/controllers/SubscriberController.php");
class Skywire_Newsletter_SubscriberController extends Mage_Newsletter_SubscriberController {
    public function newAction()
    {
        echo "here";
        exit;
    }
}

app/etc/modules/Skywire_Newsletter.xml

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

some typos in file- and directory-naming: (controllerS and SubscriberS) app/code/local/Skywire/Newsletter/controllers/SubscriberController.php:

  • Sorry, that's a typo - it already is controllers. Thanks – Valguss Jan 30 '13 at 13:20
  • the missing "r" in SubscriberController, too? – Tobias Jan 30 '13 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.