Magento - Newsletter subscribe new field not saving

空扰寡人 提交于 2020-01-15 10:46:08

问题


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:


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



来源:https://stackoverflow.com/questions/15731342/magento-newsletter-subscribe-new-field-not-saving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!