12/13/2010

How to Add Customer Group field while register in magento

It's default magento Features.You need to Edit 2 file. one is config.xml which resides in app/code/core/Mage/customer/etc/config.xml and other is Register.phtml which resides app/design/frontend/your_interface/Your_theme/template/customer/form/Register.phtml

Open Config.xml then goto line number near about 82 there add <group_id><create>1</create><update>1</update></group_id> under
<fieldsets>
<customer_account>

The code will be something like this

<fieldsets>
<customer_account>
<group_id><create>1</create><update>1</update></group_id>
</customer_account>
</fieldsets>

Now go to register.phtml and write the following code under the section where you wanrt to put.

<li>
<label for="customer_groups" class="required"><em>*</em><?php echo $this->__('Customer Groups') ?></label>
<select name="customer_groups" id="customer_groups" title="<?php echo $this->__('Customer Groups') ?>" class="validate-group required-entry input-text">
<?php $cu_groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
<?php foreach($cu_groups as $cuGroups){ ?>
<option value="<?php echo $cuGroups['value'] ?>"><?php echo $cuGroups['label'] ?></option>
<?php } ?>
</select>
</li>

2 comments:

  1. It didnt work dear. Not updating database and not displaying in admin too.

    ReplyDelete
  2. It didnt work dear. Not updating database and not displaying in admin too. please help me.

    ReplyDelete