[英]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.