我公司目前已经在启用通讯复选框:Magento CE 1.9 - 如何将注册时事通讯注册复选框添加到编辑页面?
/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去?
Newsletter Signup on CMS page in Magento
您可以使用相同的代码,但看起来EDIT块没有所有必需的功能,你可以重写。在那个块被调用的地方,你可以确保块类型是“客户/注册”,可以解决它。否则EDIT块类可以扩展Mage_Customer_Block_Form_Register类 – Dharam 2014-11-04 11:13:37