Magento - Newsletter subscribe new field not savin

2019-08-14 04:31发布

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

1条回答
We Are One
2楼-- · 2019-08-14 05:14

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

查看更多
登录 后发表回答