【问题标题】:Magento - Newsletter subscribe new field not savingMagento - 时事通讯订阅新字段不保存
【发布时间】:2013-04-06 17:48:51
【问题描述】:

我正在尝试向新闻通讯订阅表单添加一个新字段 (subscriber_type)。我已经设置了我的观察者,它正在正常工作和触发(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;
    }
}

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

谁能看出我哪里出错了?

谢谢

【问题讨论】:

    标签: magento observers


    【解决方案1】:

    这真是令人沮丧..但答案很简单:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-29
      • 1970-01-01
      相关资源
      最近更新 更多