ADD NEW FIELD CUSTOMER REGISTRATION FORM IN MAGENTO

Step 1: Create file app/etc/modules/Jwd_Customer.xml
Add this code
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Jwd_Customer>
        <codePool>local</codePool>
        <active>true</active>
        </Jwd_Customer>
    </modules>
</config>
Step 2: Create files and folder app/code/local/Jwd/Customer/etc/config.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0"?>
<config>
    <modules>
        <Jwd_Customer>
            <version>1.7.0.0</version>
        </Jwd_Customer>
    </modules>
    <global>
        <fieldsets>
            <customer_account>
                <occupation><create>1</create><update>1</update></occupation>
                <jobtitle><create>1</create><update>1</update></jobtitle>
            </customer_account>
        </fieldsets>
        <models>
            <Jwd_Customer>
                <class>Jwd_Customer_Model</class>
            </Jwd_Customer>
        </models>
        <helpers>
            <Jwd_Customer>
                <class>Jwd_Customer_Helper</class>
            </Jwd_Customer>
        </helpers>
        <resources>
            <customerattribute_setup>
                <setup>
                    <module>Jwd_Customer</module>
                    <class>Jwd_Customer_Model_Entity_Setup</class>
                </setup>
            </customerattribute_setup>
        </resources>
    </global>
</config>
Step 3: Create files and folder app/code/local/Jwd/Customer/Model/Entity/Setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
class Jwd_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup
{
    public function getDefaultEntities(){
 
        return array(
 
                'occupation'=>array(
                        'type'=> 'static',
                        'label'=> 'Occupation',
                        'visiable' => true,
                        'required' => true,
                        'sort_order' => 80,
                ),
                'jobtitle'=>array(
                        'type'=> 'static',
                        'label'=> 'Jobtitle',
                        'visiable' => true,
                        'required' => true,
                        'sort_order' => 80,
                )
        );
    }
}
?>
Step 4: Create files and folder app/code/local/Jwd/Customer/sql/customerattribute_setup/mysql4-install-0.1.0.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$installer = $this;
 
$installer->startSetup();
 
$installer->addAttribute('customer', 'occupation', array(
    'label' => 'Occupation',
    'visible' => 1,
    'required' => 0,
    'position' => 1,
    'sort_order' => 80,
));
$installer->addAttribute('customer', 'jobtitle', array(
    'label' => 'Jobtitle',
    'visible' => 1,
    'required' => 0,
    'position' => 1,
    'sort_order' => 80,
));
 
$installer->endSetup();
 
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'occupation');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
 
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'jobtitle');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
?>
Look at below image how your registartion and other page look like.



Comments

Popular posts from this blog

Get Swatch Text Product id of Configurable Product in Detail Page through Jquery Magento2

Get Customer Address with customer ID programmatically Magento2

programmaticlly Create Order in Magento2 with custom options in order