Create New Field into Magento


Chiranjeevi

Step:1

app\design\frontend\base\default\template\persistent\customer\form\register.phtml

<li>

<label for=”occupation” class=”required”><em>*</em><?php echo $this->__(‘occupation’) ?></label>

<div>

<input type=”text” name=”occupation” id=”occupation” title=”<?php echo $this->__(‘occupation’) ?>” />

</li>

2. replace the following block of code in
app/code/core/Mage/Customer/Model/Resource/Setup.php

//////////

‘group_id’           => array(

‘type’               => ‘static’,

‘label’              => ‘Group’,

‘input’              => ‘select’,

‘source’             => ‘customer/customer_attribute_source_group’,

‘sort_order’         => 25,

‘position’           => 25,

‘adminhtml_only’     => 1,

‘admin_checkout’     => 1,

),

///////////

with this
////////////

‘group_id’           => array(

‘type’               => ‘static’,

‘label’              => ‘Group’,

‘input’              => ‘select’,

‘source’             => ‘customer/customer_attribute_source_group’,

‘sort_order’         => 25,

‘position’           => 25,

‘adminhtml_only’     => 1,

‘admin_checkout’     => 1,

),

‘occupation’          => array(

‘type’               => ‘varchar’,

‘label’              => ‘Occupation’,

‘input’              => ‘text’,

‘sort_order’         => 7,

‘validate_rules’     => ‘a:2:{s:15:”max_text_length”;i:255;s:15:”min_text_length”;i:1;}’,

‘position’           => 120,

),

///////////

3. find the following line of code around line 280  in
app/code/core/Mage/Customer/controllers/AccountController.php

///////
$customerData = $customerForm->extractData($this->getRequest());
//////

and replace with
////////////
$customerData = $customerForm->extractData($this->getRequest());

//new code added to save occupation in database start here

if($this->getRequest()->getParam(‘occupation’))

{

$customer->setOccupation($this->getRequest()->getParam(‘occupation’));

View original post 582 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s