How to enable Address Information on Magento Customer Registration Page?

Posted by Damodar Bashyal on March 12, 2012

 

Step 1: app\etc\modules\Technooze_All.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Technooze_Customer>
            <active>true</active>
            <codePool>community</codePool>
        </Technooze_Customer>
    </modules>
</config>

Step 2: app\code\community\Technooze\Customer\Block\Form\Register.php

<?php
class Technooze_Customer_Block_Form_Register extends Mage_Customer_Block_Form_Register
{
    protected function _prepareLayout()
    {
        $this->showAddressFields();
        
        return parent::_prepareLayout();
    }
    public function showAddressFields()
    {
        //customer_create_account_technooze_show_register_address
        $this->setShowAddressFields(Mage::getStoreConfig('customer/create_account/technooze_show_register_address'));
    }
}

Step 3: app\code\community\Technooze\Customer\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Technooze_Customer>
            <version>1.0.0</version>
        </Technooze_Customer>
    </modules>
    <global>
        <blocks>
            <class>Technooze_Customer_Block</class>
            <customer>
                <rewrite>
                    <form_register>Technooze_Customer_Block_Form_Register</form_register>
                </rewrite>
            </customer>
        </blocks>
    </global>
</config>

Step 4: app\code\community\Technooze\Customer\etc\system.xml

<?xml version="1.0"?>
<config>
    <sections>
        <customer translate="label" module="customer">
            <groups>
                <create_account translate="label">
                    <fields>
                        <technooze_show_register_address translate="label">
                            <label>Enable Address Fields on Register</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </technooze_show_register_address>
                    </fields>
                </create_account>
            </groups>
        </customer>
    </sections>
</config>

Step 5: Goto Newly added config setting and enable address display at: admin / system / Configuration / Customers / Customer Configuration / Create New Account Options / Enable Address Fields on Register

Thats all!!!

There is an easy way too :). Just ignore step 4 and set true on step 2 as:

$this->setShowAddressFields(true);

Is there more easier way? Yes :)

Copy whole file FROM: app\code\core\Mage\Customer\Block\Form\Register.php

TO: app\code\local\Mage\Customer\Block\Form\Register.php

And add this line:

$this->setShowAddressFields(true);

on function _prepareLayout() before

return parent::_prepareLayout(); 

So, Which one do you prefer? First, Second or Third Option? Please comment with your view.

Also, Please like (+1) and follow us.

zweigelb posted on - Wednesday 16th of January 2013 10:02:09 AM

Thank you oh so much Damodar for this extension. Works wonderful ;)
Implemented it on localhost first, to see if it causes any trouble. But it just works perfect. Thanks

NSM1984 posted on - Tuesday 30th of July 2013 11:59:22 PM

WOW thank you sooo much! worked like a charm and did it in 2 mins. Was doing so much searching online for this. you rock!!!
I picked the 3rd and easiest method on version 1.7.0.2

Delwar posted on - Tuesday 15th of July 2014 09:36:58 PM

Third method also work on 1.8.1
 
not published on website


QR Code: How to enable Address Information on Magento Customer Registration Page?