Customer Group Registration
A feature that is absent from the Magento frontend is the ability for a customer to choose which customer group they belong to during registration, no different to what is available to the admin when they choose to register new customers. This can be quite important in instances where you wish to apply different tax rules to different types of customer. For example you might have General Customers and VAT Exempt customers.
To enable this ability is actually extremely simple. Firstly, XML. Open config.xml from app > code > core > Mage > Customer > etc > config.xml and add the following line of code into the customer account fieldset:
<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>
<group_id><create>1</create><update>1</update></group_id>
<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>
</customer_account>
</fieldsets>
Now you need to add code to the frontend of the store, in the registration form. Open template/customer/form/register.phtml and add the following code somewhere 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>
That’s all there is to it – customers can now choose which group they belong to during sign up.
