2

Is it possible to move Telephone fields from billing address to the customer create account section? I need to modify account creation page by directly making changes on core files. Is that possible ? Or there are any settings available in adminpanel to fetch customer address also during registration ?

I just tried by adding

<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label> <div class="input-box"> <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" /> </div>

to persistent/customer/form/register.phtml file. Now the field is visible in create page. But its not getting saved.

Thanks in advance!

1 Answer 1

6

It's possible 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

Answer to updated question

It's a totally different question now. To allow saving the telephone attribute of the customer in the registration form, you need to tell Magento that it is allowed to be used in that form (this was introduced in Magento 1.5 to prevent customers to modify arbitrary attributes that are not meant to be changed by them).

Write a setup script (as part of a new module, or an existing one if you already have a custom module dedicated to theme and configuration) which contains the following:

Mage::getSingleton('eav/config')
    ->getAttribute('customer', 'telephone')
    ->setData('used_in_forms', array('customer_account_create'))
    ->save();

Source: http://www.schmengler-se.de/en/2011/03/magento-1-5-neue-kundenattribute-im-backend-fomular-sichtbar-machen/

7
  • Thanks. Is there any way to add only telephone number field to registration ?
    – Anu
    Feb 17, 2015 at 4:13
  • You can remove fields from the templates in persistent/customer/form/register.phtml and customer/form/register.phtml but if you keep only the phone number you will get validation errors at some point because the address is incomplete. Maybe better add the phone number as customer attribute? Feb 17, 2015 at 6:33
  • But telephone field is an existing field in the customer section, is there any option to enable it.
    – Anu
    Feb 18, 2015 at 7:22
  • Right, then add a form input with name="telephone" to the templates mentioned above and write a setup script that contains Mage::getSingleton('eav/config')->getAttribute('customer', 'telephone')->setData('used_in_forms', ['customer_account_create'])->save(); Feb 18, 2015 at 8:04
  • This is to be added in our addon setup file or core file?
    – Anu
    Feb 18, 2015 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.