to add customer group in registration form

make a copy of config.xml from app > code > core > Mage > Customer > etc > config.xml and add the following line of code into the customer account fieldset and save it to app > code >local>config.xml and in this file add the following line of code into the customer account fieldset:



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



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>



also change some code in app\code\core\Mage\Customer\controllers\AccountController.php now
replace $customer->getGroupId();
with

 if($this->getRequest()->getPost('group_id'))
 { $customer->setGroupId($this->getRequest()->getPost('group_id'));
 } else {
$customer->getGroupId(); }

http://develop-webapp.blogspot.in/2013/05/how-to-add-customer-group-in.html

Comments

Popular Posts

Magmi Single and Multiple Category Importer