Magento-新闻订阅不保存新字段 [英] Magento - Newsletter subscribe new field not saving

查看:48
本文介绍了Magento-新闻订阅不保存新字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向新闻通讯订阅表单添加一个新字段(subscriber_type).我已经设置了观察器,并且它可以正常工作并正确触发(newsletter_subscriber_save_before):

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;
    }
}

我还将该字段添加到了数据库中.上面的代码添加了新的订阅者,但没有添加subscriber_type.

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?

谢谢

推荐答案

这个让人很沮丧..但是答案很简单:

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

Magento缓存表描述,因此请确保在向数据库添加新字段后清除缓存.

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

感谢MJA的回答: https://stackoverflow.com/a/10550476/491055

这篇关于Magento-新闻订阅不保存新字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆