Ahmad
Ahmad

Reputation: 2129

how to add the address fields in the customer registration form?

I am using magento 1.6. And I want to display the address fields on the customer registration form. I remove the following lines from the register.phtml but it did not work.

<?php if($this->getShowAddressFields()): ?>
<?php endif; ?>

So what should I do?

Upvotes: 3

Views: 6718

Answers (4)

hardik
hardik

Reputation: 197

go to : app/design/frontend/base/default/layout/local.xml

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

Register.phtml app/design/frontend/base/default/template/customer/form/register.phtml

<?php if($this->getShowAddressFields()): ?>

Upvotes: 2

Fabian Schmengler
Fabian Schmengler

Reputation: 24551

The show_address_fields attribute is intended to be set in your theme via layout XML.

In your theme's local.xml, add the following lines (before </layout>):

<customer_account_create>
  <reference name="customer_form_register">
    <action method="setShowAddressFields"><value>1</value></action>
  </reference>
</customer_account_create>

If you don't have a customized theme but a bought one, you should create a child theme for customizations like this.

Example

For the Ultimo theme, the theme resides in app/design/frontend/ultimo/default (Ultimo is the "package", "default" the theme).

You should then create the directory app/design/frontend/ultimo/yourname/layout and add a file local.xml there:

<?xml version="1.0"?>
<layout>
  <customer_account_create>
    <reference name="customer_form_register">
      <action method="setShowAddressFields"><value>1</value></action>
    </reference>
  </customer_account_create>
</layout>

Then configure the custom theme:

screenshot

Upvotes: 1

MTM
MTM

Reputation: 919

IF you are using magento 1.6 or above, and simply commenting following in customers/form/register.phtml

<?php if($this->getShowAddressFields()): ?>
<?php endif; ?>

is not working then possibly you have active the persistent cart. In that case you need to comment the same lines in persistent/customer/form/register.phtml and it will work for you. Don't forget to comment the same above code from the script on the end of the same page, which is for Region Updater.

Upvotes: 4

Mithun Sasidharan
Mithun Sasidharan

Reputation: 20920

Refer this DOC

Try

<input name="x" id="x" title="<?php echo $this->__('x') ?>" value="" type="text"/>

Upvotes: -2

Related Questions