Categories
Magento

How to display address fields on registration form – Magento

Please create local.xml in your theme layout folder.

Refer the code below in local.xml:

<layout version="0.1.0">

    <customer_account_create> 
      <reference name="customer_form_register">   
        <action method="setShowAddressFields">
          <param>true</param></action>    
      </reference>
    </customer_account_create>

</layout>

or

In customer.xml (current theme layout), add the below code in customer_account_create node:

<action method="setShowAddressFields"><value>true</value></action>

so it look like

<reference name="content">          
    <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
       <action method="setShowAddressFields"><value>true</value></action>
       <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>

Clear the cache after added code.

Please find the _basicCheck function in Mage_Customer_Model_Address_Abstract, this validating the registration required fields, so you have to rewrite this function _basicCheck.

Please refer this link its for telephone field (customize for zipcode field), have a look on this. Hope this will helps