繁体   English   中英

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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM