我想为客户添加选项,可以在结账时订阅时事通讯谢谢页面。
如何删除“提交”按钮,并且只有一个复选框?
谢谢
现在,在我的成功页面中,我添加了以下代码:
<div class="order-newsletter">
<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml(); ?>
</div>
更新
我找到了这段代码但是在结帐成功页面中我有这个错误:
致命错误:在非对象上调用成员函数getEmail()
<?php
$checked = true;
if($this->getFormData()->getEmail()) {
if(!$this->getFormData()->getIsSubscribed()) {
$checked = false;
}
}
?>
<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"<?php if($checked): ?> checked="checked"<?php endif; ?> class="checkbox" />
</div>
<label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
<?php /* Extensions placeholder */ ?>
<?php echo $this->getChildHtml('customer.form.register.newsletter')?>
</li>
答案 0 :(得分:1)
试试这个https://magento.stackexchange.com/a/52285/14174
您需要添加简报的添加框,然后挂钩观察者以将客户添加到订阅列表中。