Thursday, January 16, 2014

Add Customer group in registration page

If you want to customer can select customer group during registration, then add <group_id><create>1</create></group_id> code into the customer account fieldset.(app\code\core\Mage\Customer\etc\config.xml)

<fieldsets>
<customer_account>
<prefix><create>1</create><update>1</update><name>1</name></prefix>
<firstname><create>1</create><update>1</update><name>1</name></firstname>
<middlename><create>1</create><update>1</update><name>1</name></middlename>
<lastname><create>1</create><update>1</update><name>1</name></lastname>
<suffix><create>1</create><update>1</update><name>1</name></suffix>
<email><create>1</create><update>1</update></email>
<password><create>1</create></password>
<confirmation><create>1</create></confirmation>
<dob><create>1</create><update>1</update></dob>
<taxvat><create>1</create><update>1</update></taxvat>
<group_id><create>1</create></group_id>
</customer_account>
</fieldsets>

Open template/customer/form/register.phtml and add the following code anywhere in the form

<div class="input-box">
<label for="group_id"><?php echo $this->__('Group') ?><span class="required">*</span></label><br/>
<select name="group_id" id="group_id" title="<?php echo $this->__('Group') ?>" class="validate-group required-entry input-text" />
<?php $groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
<?php foreach($groups as $group){ ?>
<option value="<?php print $group['value'] ?>"><?php print $group['label'] ?></option>
<?php } ?>
</select>
</div>

1 comment:

  1. Hi, Sap..

    Good Work, thanks..
    Please help me to find a solution as i am new to magento..
    how to assign admin user to a specific customer group or groups ..?
    like one user to manage one customer group, user will be restricted to other groups...

    if you could find a solution it will be appreciated..

    Thanks & Regards
    Jayee

    ReplyDelete