Magento登录并注册一页

Hei*_*ess 5 php layout magento

我正在尝试将登录表单和Magento中的帐户表单合并为一个页面.原因是我认为页面越少越好.我发现Magento令人困惑,对其布局和模板系统的理解有限.我决定最简单的方法是将登录表单添加到注册帐户页面.我在login.phtml中找到了登录表单并注册了表单,在template/customer/form /中找到了register.phtml.

我只是将login.phtml中的PHTML代码复制到同一目录下的register.phtml文件中.这就是我最终得到的结果:

http://pastebin.com/fpkeBsxc

在我填写帐户的电子邮件和密码并单击登录后,页面将返回验证错误,并参考下面的注册帐户表单.基本上,我不确定这是因为我的方法是完全愚蠢/错误的,我不能像这样复制和粘贴代码,或者这是一个我看不到的简单html问题?我认为可能是错误的方式,因为注册表格有效.我会在评论中发布这个截图,它不会让我粘贴多个链接.谢谢你的建议.

小智 8

<reference name="content">            
    <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml">
        <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml" />            
    </block>
</reference>
Run Code Online (Sandbox Code Playgroud)

通过这个你可以把HTML放在customer/form/login.phtml中你想放在哪里

<?php echo $this->getChildHtml('customer_form_register') ?>
Run Code Online (Sandbox Code Playgroud)


小智 7

在主题中的customer.xml中,您可以将帐户注册块移动到登录页面中.

 <customer_account_login translate="label">
    <label>Customer Account Login Form</label>
    <!-- Mage_Customer -->
    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>


     <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
            <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
                <label>Form Fields Before</label>
            </block>
        </block> </reference>
</customer_account_login>
Run Code Online (Sandbox Code Playgroud)


Ant*_*n S 2

你应该做一些稍微不同的事情:

  1. 了解 magento 布局及其工作原理
  2. 使用布局引用将两个现有表单包含到一个模板中
  3. 让他们提交给现有的控制者