sulman
sulman

Reputation: 2461

Magento - Newsletter subscribe new field not saving

I am trying to add a new field (subscriber_type) to the newsletter subscribe form. I have setup my observer and it is working and firing correctly (newsletter_subscriber_save_before):

<?php
class Mynamespace_Enhancednewsletter_Model_Observer {
    public function saveBefore($observer){
        $subscriber = $observer->getEvent()->getSubscriber();
        $type = Mage::app()->getRequest()->getParam('type'); // this contains my new data correctly
        $subscriber->setSubscriberType($type);
        return $this;
    }
}

I have also added the field to the db. The above code adds the new subscriber but doesn't add the subscriber_type.

Can anyone see where I'm going wrong?

Thanks

Upvotes: 1

Views: 1295

Answers (1)

sulman
sulman

Reputation: 2461

Man this one was frustrating..but the answer was so simple:

Magento caches table descriptions so make sure you clear your cache after adding a new field to the db.

Thanks to MJA for the answer: https://stackoverflow.com/a/10550476/491055

Upvotes: 1

Related Questions