Magento registers and registers on one page

I am trying to combine a login form and create an account form in Magento on one page. The reason is that I just think that the fewer pages, the better. I find Magento a confused and limited understanding of its layout and template system. I decided that the easiest way to do this is to simply add the login form to the account page. I found the login form and register the form in login.phtml and register.phtml in the template / client / form /.

I just copied the PHTML code from login.phtml to the register.phtml file, which is in the same directory. This is what I came across:

http://pastebin.com/fpkeBsxc

After filling out the email and password of the account and logging in, the page returns with verification errors, referring to the account form below. Basically, I'm not sure if this is because my approach is completely stupid / wrong, and I can’t just copy and paste code like this, or is it a simple html problem that I don’t see? I think this may be wrong as the registration form works. I will post a screenshot of this in a comment, it will not allow me to insert more than one link. Thanks for any advice.

+5
source share
4 answers

In customer.xml in your topic, you can move the account registration unit to the login page.

 <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>
+7
<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>

u html, //login.phtml

<?php echo $this->getChildHtml('customer_form_register') ?>
+6

Magento , :
1. mini.register.phtml
: app/design/frontend/[your-interface]/[your-theme]/template/customer/form/mini.register.phtml
: app/design/frontend/base/default/template/customer/form/register.phtml mini.register.phtml .

2. mini.register.phtml login.phtml
: app/design/frontend/base/default/template/customer/form/login.phtml :

app/design/frontend/[your-interface]/[your-theme]/template/customer/form/login.phtml

login.phtml, mini.register.phtml.
XML- XML ( app/design/frontend/[your-interface]/[your-theme]/layout/local.xml) :

<customer_account_login translate="label">
    <reference name="content">
        <action method="unsetChild"><child>customer_form_login</child></action>
        <block type="customer/form_login" name="customer_form_login2" template="customer/form/login.phtml" >
            <block type="customer/form_register" name="customer_form_register2" template="customer/form/mini.register.phtml">
                <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" />
            </block>
        </block>
    </reference>
    <reference name="head">
        <action method="setTitle" translate="title" module="customer"><title>Login or Create an Account</title></action>
    </reference>
</customer_account_login>

mini.register.phtml login.phtml :

<?php echo $this->getChildHtml('customer_form_register2'); ?>
  • Everything is ready. Now clear the cache and reload the client login page:http://your-mage-store/customer/account/login
+3
source

You should do it a little differently:

  • Learn Magento layout and how it works.
  • use layout links to include both existing forms in one template
  • let them obey existing controllers
+2
source

All Articles