Magento CE 1.9-如何将注册时事通讯注册复选框添加到编辑页面


Magento CE 1.9 - How can I add the register newsletter signup checkbox to the edit page?

我目前在中启用了时事通讯复选框

/app/design/frontend/new/default/template/customer/form/register.php

它似乎在模板文件中使用了以下代码:

<?php if ($this->isNewsletterEnabled()): ?>
    <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
    <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
    <?php echo $this->getChildHtml('customer.form.register.newsletter')?>
<?php endif ?>


问题

如何将相同的表单输入添加到编辑帐户页面?

/app/design/frontend/new/default/template/customer/form/edit.php

只复制上面的代码会出现以下错误,这显然意味着没有包含所需的函数。

我猜这意味着我在某个地方丢失了一些XML。。。但是在哪里?

Fatal error: Call to a member function getIsSubscribed() on a non-object

我想我可能需要将以下内容添加到布局文件中,这应该是customer.xml吗?如果是,在该文件中的位置?在这个标签<customer_account_edit translate="label">里面?

{{block type="newsletter/subscribe" template="newsletter/subscribe.phtml"}}


研究

我发现了以下Magento StackOverflow问题,但它没有回答XML的去向?

在Magento 的CMS页面上注册时事通讯

您可以在/app/design/frontend/new/default/template/customer/form/edit.phtml文件中使用此代码

<li class="control">
    <div class="input-box">
        <input type="checkbox" name="is_subscribed" 
               title="<?php echo $this->__('Sign Up for Newsletter') ?>" 
               value="1" id="is_subscribed" class="checkbox" />
    </div>
    <label for="is_subscribed">
        <?php echo $this->__('Sign Up for Newsletter') ?>
    </label>
    <?php echo $this->getChildHtml('customer.form.register.newsletter')?>
</li>