[英]Magento: modifying the newsletter module
magento的时事通讯表带有名字和姓氏字段,但在默认设置中只保存电子邮件地址。 我想使用名字字段,但在找到保存记录的位置时遇到了一些麻烦。
现在这是我的表单:
<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
<div class="block-content">
<table>
<tr>
<td><label for="firstname"><?php echo $this->__('Name:') ?></label></td>
<td>
<div class="input-box">
<input type="text" name="firstname" id="firstname" title="<?php echo $this->__('Name') ?>" class="input-text" />
</div>
</td>
</tr>
<tr>
<td> <label for="newsletter"><?php echo $this->__('Email:') ?></label></td>
<td>
<div class="input-box">
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>" class="input-text required-entry validate-email" />
</div>
</td>
</tr>
<tr>
<td></td>
<td>
<div class="actions">
<button type="submit" title="<?php echo $this->__('Subscribe') ?>" class="button"><?php echo $this->__('Sign Up') ?></button>
</div>
</td>
</tr>
</table>
</div>
</form>
有一个类似的帖子,但我认为它现在已经过时,因为我似乎找不到_prepareSave函数。
有人可以帮助正确的方向吗?
谢谢,比利
可以在此处找到向Magento新闻稿订阅者对象添加自定义字段的更简单的解决方案
新闻稿和订阅者表至少在最新版本Magento EE 1.9.1.1中不包含名字和姓氏字段。
如果要向订阅者表添加其他字段,则应更新Mage_Newsletter_Model_Subscriber
类的subscribe
方法(它只接收一个电子邮件地址,您应该传递其他参数)和控制器Mage_Newsletter_SubscriberController
,操作newAction
以便它提取其他来自$ _POST数组的字段,用于创建简报订阅(搜索指令$status = Mage::getModel('newsletter/subscriber')->subscribe($email)
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.